我有一个List,我试图使用LINQ查询.T类型具有List <U>的属性.我试图查询我的List <T>的List <U>属性,只拉取那些List属性项与我为过滤构建的单独List <U>中的项匹配的对象.我的代码看起来像这样:
class T {
List<U> Names;
}
class U {
}
//then I want to query a List of T by interrogating which T objects' Names property has the same items that I have a List < U > that I have created.
List<U> searchTermItems;
List<T> allObjects;
//Query allObjects and find out which objects' Name property items match the items in the searchTermItems list
Run Code Online (Sandbox Code Playgroud) 我有一个MVVM实现,其中我有一个WPF ListBox,它将包含一个子WPF图像控件的集合.每个控件的Source可能每秒更改3次.当我的列表中只有一个图像时,生活很美,我的应用程序响应迅速.当我开始有4或5个我的应用程序子图像时,我的应用程序开始研磨,我还应该提到我必须为每个新的和/或更新的图像进行Bitmap到BitmapSource转换.
我应该如何更新我的子控件Source属性,同时尽可能保持我的应用程序响应?
这是我的ViewModel中的当前代码:
public BitmapSource CameraBitmapSource
{
get
{
Application.Current.Dispatcher.BeginInvoke((Action)delegate
{
BuildImageSource();
}, DispatcherPriority.Background);
return this.cameraBitmapSource;
}
}
Run Code Online (Sandbox Code Playgroud)
BuildImageSource()是我获取新位图并转换为BitmapSource然后分配给我的私有cameraBitmapSource对象的地方.
我有一个ItemsControl
计划主持水果对象列表.我有一个Fruit
对象列表都有自己的DataTemplate
s.我有一个Grape
物体,一个Orange
物体和一个Kiwi
物体.
我想使用a UniformGrid
使所有单元格具有相同的大小,但我希望Kiwi
对象只跨越1个单元格,我希望Grape
跨越2个单元格(ColumnSpan = 2
)并且我希望Orange
控件跨越4个单元格(ColumnSpan = 2
和RowSpan = 2
)
我怎么能做到这一点?