I have two ItemsControls, one a ListView, and one a custom control I am developing.
I have set the ItemsControl.ItemsSource property of both controls to the same IEnumerable object, in this case, a List.
I apply a filter to the ItemsControl.Items property of my custom control (this.Items.Filter = myFilter) and my control refreshes as expected, showing only the items that match the filter.
However, the ListView using the same IEnumerable object for its ItemsControl.ItemsSource property also refreshes, showing only the items that match the filter I applied to my custom control.
Can anyone tell me how to keep the filter in my custom control from affecting the items in my listview?
The first thing I can think of, that doesn’t require any bigger modifications to what you described is to just to wrap the ItemsSource collections in a CollectionViewSource in your XAML where they are being assigned.
And then the filtering logic: