I\'m using a an ObservableCollection with two ICollectionView for different filters.
One is for filtering messages by some type, and one is
For anyone struggling with the problem that the filteredView does not observe the sourceCollection (messageList in this example):
I came around with this solution:
ICollectionView filteredView = new CollectionViewSource { Source=messageList }.View;
messageList.CollectionChanged += delegate { filteredView.Refresh(); };
So it will refresh our filteredView evertytime the CollectionChanged event of the source get's fired. Of course you can implement it like this too:
messageList.CollectionChanged += messageList_CollectionChanged;
private void messageList_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
filteredView.Refresh();
}
Consider using PropertyChanged-Events when filtering on a specific Property is wanted.