I have a grid that I only ever want to show a subset of data items. I want the user to be able to play around with the filters, so I've created a CollectionView based on the original collection that has the permanent filter set. This CollectionView is set as the grid's ItemsSource so that the permanent filter and the user defined filters (FilterCollection) are kept separate.
However, I get an index out of bounds exception when adding items to the original collection. It looks like this is because the INotifyCollectionChangedEventArgs are specifying an index that is present in the original collection, but too high once the CollectionView filter has been applied.
Is this a strategy that should work and I'm missing something, or does anyone know of a better way to have a filter always set on the grid, despite calling FilterCollection.Clear() (my fallback strategy is to now create a FilterDescriptor to do the same job and re-add it every time I clear the filters).
However, I get an index out of bounds exception when adding items to the original collection. It looks like this is because the INotifyCollectionChangedEventArgs are specifying an index that is present in the original collection, but too high once the CollectionView filter has been applied.
Is this a strategy that should work and I'm missing something, or does anyone know of a better way to have a filter always set on the grid, despite calling FilterCollection.Clear() (my fallback strategy is to now create a FilterDescriptor to do the same job and re-add it every time I clear the filters).