このように定義してCollectionViewSource
いますが、フィルターが機能していないようです。
CollectionViewSource cvs = new CollectionViewSource();
//oc IS AN OBSERVABLE COLLECTION WITH SOME ITEMS OF TYPE MyClass
cvs.Source = oc;
//IsSelected IS A bool? PROPERTY OF THE MyClass
cvs.View.Filter = new Predicate<object>(input=>(input as MyClass).IsSelected == true);
//Major IS AN string PROPERTY OF THE MyClass
cvs.SortDescriptions.Add(new SortDescription(
"Major", ListSortDirection.Ascending));
しかし、私はこの方法でコードを変更し、すべてが解決しました!
CollectionViewSource cvs = new CollectionViewSource();
cvs.Source = oc;
cvs.SortDescriptions.Add(new SortDescription(
"Major", ListSortDirection.Ascending));
cvs.View.Filter = new Predicate<object>(input=>(input as MyClass).IsSelected == true);
誰でも方法を知っていますか?