I\'m using the MVVM design pattern, with a ListView bound to a ListCollectionView on the ViewModel. I also have several comboboxes that are used to filter the ListView. When t
Every time you set Filter property you reset previous filter. This is a fact. Now how can you have multiple filters?
As you know, there are two ways to do filtering: CollectionView
and CollectionViewSource
. In the first case with CollectionView
we filter with delegate, and to do multiple filters I'd create a class to aggregate custom filters and then call them one by one for each filter item. Like in the following code:
public class GroupFilter
{
private List> _filters;
public Predicate
To refresh filtered view you can make a call to ListCollectionView.Refresh()
method.
And in the second case with CollectionViewSource
you use Filter
event to filter collection. You can create multiple event handlers to filter by different criteria. To read more about this approach check this wonderful article by Bea Stollnitz: How do I apply more than one filter? (archive)
Hope this helps.
Cheers, Anvaka.