小编Jea*_*hhe的帖子

ICollectionView 获取特定对象

我正在使用ICollectionView包含对象列表的 a 。我需要根据某些对象属性从中获取特定对象,有没有办法做到这一点?

例如,对象是 aUser并且我需要提供 name来获取这个对象。我该怎么做?

private readonly ICollectionView usersCollectionView;

public MappingViewModelView()
{
    _UsersList = new ObservableCollection<User>
    {
        new User {Name = "Jhon"},

    };
    usersCollectionView = CollectionViewSource.GetDefaultView(_UsersList);
    UsersCollectionView.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
}
Run Code Online (Sandbox Code Playgroud)

c# wpf xaml mvvm

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

禁用时更改按钮颜色

我使用以下按钮,当isDisabled为true时,按钮是透明的(这里的例子总是如此,但在我的程序中它的命令...)我想要的是当按钮被禁用时颜色保持不变ligther,我怎么能得到那个?

    <Button  
                             Width="100"
                             Height="25"
                             Background="#f0ab00"
                             Content="Run"
                             FontSize="16"
                             Foreground="#ffffff"
                             IsDefault="True"
                             Margin="10,0,20,0"
                             IsEnabled="false" />

</Grid>
Run Code Online (Sandbox Code Playgroud)

c# wpf xaml mvvm

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

将DB从本地更改为azure不起作用

我已经在visual studio 2013中创建了MVC 5项目,该项目针对本地数据库并且按预期工作,现在我想用我在azure中创建的新数据库替换localDb(v11)(相同的数据结构),我该怎么做那个?我想我需要用服务器和数据库名称替换连接字符串,但由于连接字符串太长,我不知道究竟应该删除和添加什么,请协助.

c# asp.net asp.net-mvc azure asp.net-mvc-5

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

两秒后删除信息消息

我有这个代码,它在页面顶部提供用户信息消息,目前它在那里,直到用户点击X按钮,我的问题是,如果用户有一种方法可以删除,如果用户在2秒后自动淡出此消息不点击X?

   function addessage(message) {
        $messages.html("<div class='alert alert-info'><strong>Information : </strong>" + message + "<button type='button' class='close' aria-hidden='true'>&times;</button></div>");
    }
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

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

用参数调用resx

我在我的项目中使用resx文件进行翻译,并且当我使用没有参数的文本时,我想要替换将来自此文件的所有文本

objRes.ErrorMsg = Group.err_message_duplicate;//This replace the entire string
Run Code Online (Sandbox Code Playgroud)

问题是我想替换以下字符串

 objRes.ErrorMsg = "user " + username + " doesn't exist in" + table;
Run Code Online (Sandbox Code Playgroud)

为此,我在resx文件中创建以下条目

User  {0} doesn't exist in {1}
Run Code Online (Sandbox Code Playgroud)

我应该如何将regx与参数一起使用

c# asp.net asp.net-mvc resx

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

标签 统计

c# ×4

asp.net ×2

asp.net-mvc ×2

mvvm ×2

wpf ×2

xaml ×2

asp.net-mvc-5 ×1

azure ×1

html ×1

javascript ×1

jquery ×1

resx ×1