WPF Filter a ListBox

CollectionViewSource class can help here. As far as I can tell it has many capabilities to filter, sort and group collections.

ICollectionView view = CollectionViewSource.GetDefaultView(ElementList);
view.Filter = (o) => {return o;}//here is the lambda with your conditions to filter

When you don’t need any filter just set view.Filter to null.
Also check out this article on filtering

Leave a Comment