2011-09-10 7 views
2

持っては私の状況です:同じItemSourceが、別のビューはここで、各リストボックス

のObservableCollectionが存在していると、ウィンドウ内のリストボックスのシリーズは、彼らのバインドされたデータを示しています。

public Records myRecents; 

//... 

this.lbToday.ItemsSource = myRecents; 
this.lbYesterday.ItemsSource = myRecents; 
this.lbBefore2Days.ItemsSource = myRecents; 
this.lbLast7Days.ItemsSource = myRecents; 
this.lbLast30Days.ItemsSource = myRecents; 

今、それぞれのフィルタリングされたビューに各リストボックスを適用したいと思います。

this.lbToday.Items.Filter = delegate(object item) 
{ 
    return ((RecordItem)item).IsToday(); 
}; 

問題は、フィルタが同じitemsourceを使用して、すべてのリストボックスに適用される。(この場合、 「myRecents」)

どのようにフィルタリング各リストボックスを異なる適用することができますか?

答えて

2

使用あなたのリストボックスの各1

this.lbToday.ItemsSource = new ListCollectionView(myRecents); 
this.lbYesterday.ItemsSource = new ListCollectionView(myRecents); 
this.lbBefore2Days.ItemsSource = new ListCollectionView(myRecents); 
this.lbLast7Days.ItemsSource = new ListCollectionView(myRecents); 
this.lbLast30Days.ItemsSource = new ListCollectionView(myRecents); 
+0

おかげで異なるListCollectionViews!それは解決しました! – mjk6026

関連する問題