0
我正在嘗試過濾ICollectionView,我想通過IcollectionView的每個對象中的可觀察集合的內容來過濾它。在對象集合中搜索字符串CollectionView
在collectionView中,我有對象,每個對象都有一個名爲SomeObject的對象集合,我想通過Textsearch字符串出現在集合中的任何SomeObject對象中來過濾CollectionView。
我希望這是SENCE ...
我已經嘗試了幾個不同勢的方法都無濟於事和IM而卡住:(我似乎無法讓我的頭圍繞這一個。我認爲,這需要一些瘋狂的LINQ ,我剛開始可以學到一些東西。
View.Filter = new Predicate<object>(o => ((BasePropertyTypeVM)o).Properties.Contains(i => ((SomeProperty)i).Value.Contains(TextSearch)));
View.Filter = new Predicate<object>(o => ((BasePropertyTypeVM)o).Properties.Contains(new Predicate<object>(i => ((SomeProperty)i).Value.Contains(TextSearch);
View.Filter = new Predicate<object>(o => ((BasePropertyTypeVM)o).Properties.Where(i => i.Value.Contains(TextSearch)));
感謝,
山姆
嘗試,如果這個工程(我沒有測試它的機會):'View.Filter = O =>((BasePropertyTypeVM)O).Properties.Any(P => p.Contains(文本搜索));' – cubrr 2015-03-03 12:29:13