小编ast*_*ght的帖子

为什么我的listboxitems没有崩溃?

如果我单击列表中间的项目,我希望除了1个元素之外的所有元素都会折叠.实际输出是剩下许多项目.为什么?这是整个计划.

using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;

namespace WpfApplication2
{
    public partial class MainWindow : Window
    {
        public class obj { }

        public MainWindow()
        {
            InitializeComponent();
            List<obj> objList = new List<obj>();
            for (int i = 0; i < 30; i++) objList.Add(new obj());
            lb.ItemsSource = objList;
        }

        private void lb_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBox lb = sender as ListBox;
            for (int i = 0; i < lb.Items.Count; i++)
            {
                ListBoxItem tmp = (ListBoxItem)(lb.ItemContainerGenerator.ContainerFromItem(lb.Items[i]));
                if (tmp != null)
                { …
Run Code Online (Sandbox Code Playgroud)

c# wpf xaml

6
推荐指数
1
解决办法
1152
查看次数

在xaml中创建自定义VisualState并在CodeBehind中手动设置它

我有一个TabItem样式,它有VisualStates.

<VisualState x:Name="MouseOver"> 
<!-- Tab turns bronze when mouseover -->
</VisualState>
Run Code Online (Sandbox Code Playgroud)

现在我希望有一个自定义的可视状态,并在代码隐藏中手动设置状态,而不是依赖于MouseOver事件.

<VisualState x:Name="CustomVisualState">
<!-- this will be a storyboard to cause flashing -->
</VisualState> 
Run Code Online (Sandbox Code Playgroud)

然后我需要在CodeBehind中设置它.

MyTabItem.VisualState = CustomVisualState.  //something like this
Run Code Online (Sandbox Code Playgroud)

wpf xaml coding-style

6
推荐指数
1
解决办法
7832
查看次数

如何使隐式滚动查看器出现在左侧而不是右侧

当列表中有足够的对象时,我有一个ScrollViewer出现在右侧.如何让它出现在左侧?

<ListBox 
x:Name="MessageListBox" 
BorderThickness="0" 
ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
HorizontalContentAlignment="Stretch"  
AlternationCount="2" 
ItemContainerStyle="{StaticResource AltStyle}" 
SelectionMode="Extended" 
>
 <ListBox.ItemTemplate >
  <DataTemplate>
   <!-- button --> 
<!-- closing tags --> 
Run Code Online (Sandbox Code Playgroud)

wpf xaml

6
推荐指数
2
解决办法
6737
查看次数

我将如何处理.NET对象哈希码?

在C#对象具有四种方法- { Equals,GetType,ToString,GetHashCode}.
有人可以用哈希码做什么有用的事情?

.net c#

6
推荐指数
1
解决办法
735
查看次数

为Winforms DataGrid控件添加超链接列

如何为Winforms DataGrid控件添加超链接列?

现在我正在添加这样的字符串列

DataColumn dtCol = new DataColumn(); 
dtCol.DataType = System.Type.GetType("System.String");
dtCol.ColumnName = columnName;
dtCol.ReadOnly = true;
dtCol.Unique = false;
dataTable.Columns.Add(dtCol);
Run Code Online (Sandbox Code Playgroud)

我只需要它是一个超链接而不是一个字符串.我在框架3.5中使用C#

winforms

5
推荐指数
1
解决办法
6352
查看次数

WCF集合序列化,IList还是List?有关系吗?

通过WCF序列化时是否有一个更好的集合对象?我正在尝试在List或IList之间做出决定,并想知道它是否有所作为?

wcf serialization

5
推荐指数
1
解决办法
2104
查看次数

-CSD太晚了

试图从parsCit运行这个小的perl程序:

parsCit-client.pl e1.txt [filename]第1行的-CSD选项太迟了

e1.txt在这里:http://dl.dropbox.com/u/10557283/parserProj/e1.txt

我从win7 cmd运行程序,而不是Cygwin.

filename是parsCit-client.pl - 整个程序在这里:

#!/usr/bin/perl -CSD
#
# Simple SOAP client for the ParsCit web service.
#
# Isaac Councill, 07/24/07
#
use strict;
use encoding 'utf8';
use utf8;
use SOAP::Lite +trace=>'debug';
use MIME::Base64;
use FindBin;

my $textFile = $ARGV[0];
my $repositoryID = $ARGV[1];

if (!defined $textFile || !defined $repositoryID) {
    print "Usage: $0 textFile repositoryID\n".
    "Specify \"LOCAL\" as repository if using local file system.\n";
    exit;
}

my $wsdl = "$FindBin::Bin/../wsdl/ParsCit.wsdl";

my …
Run Code Online (Sandbox Code Playgroud)

perl

5
推荐指数
1
解决办法
1055
查看次数

禁用在结帐TFS上获取最新信息

我必须将项目恢复到上周的版本.所以我按日期得到了一个特定的版本,但现在如果我为文件添加一个空格,它会检出并获取最新版本.

我去了工具 - >选项 - >源代码控制 - > VS TFS - >"在结帐时获取最新版本" - >未选中.

然后我去了工具 - >源代码控制设置 - >"启用最新签出" - >未选中.

但行为仍然发生!不知道该尝试什么.

tfs

5
推荐指数
1
解决办法
2077
查看次数

如何在ASP MVC中创建自定义路由

我正在尝试做这样的事情.

MyUrl.com/ComicBooks/{NameOfAComicBook}

我和RouteConfig.cs搞砸了,但我对此完全是新手,所以我遇到了麻烦. NameOfAComicBook是必需参数.

public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");


        routes.MapMvcAttributeRoutes();


        routes.MapRoute("ComicBookRoute",
                            "{controller}/ComicBooks/{PermaLinkName}",
                            new { controller = "Home", action = "ShowComicBook" }
                            );

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );

    }
}
Run Code Online (Sandbox Code Playgroud)

HomeController.cs

public ActionResult ShowComicBook(string PermaLinkName)
{


    // i have a breakpoint here that I can't hit


    return View();
}
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc asp.net-mvc-routing

5
推荐指数
1
解决办法
7942
查看次数

如何查看 iPhone Safari serviceworker console.log 消息?

如何查看 iPhone Safari ServiceWorker console.log 消息?我看到了如何查看 Mac Safari ServiceWorker console.log 消息,但我没有看到如何查看 iPhone Safari ServiceWorker console.log 消息

我有我的 iPhone 连接到我的 Mac...在 Mac 的 Safari 中的 Develop 菜单项中,我有两个相关项目:

iPhone -> [我的网站] ->(提供了很多选项,包括 iPhone 的 console.logs 但不包括 iPhone 的 ServiceWorkers 的 console.logs

Service Workers -> 这为 Mac 的 ServiceWorkers 提供了选项,而不是 iPhones

service-worker

5
推荐指数
0
解决办法
441
查看次数