The Filter property of CollectionView
and CollectionViewSource
is an event and contains a collection of type FilterEventHandler
, not Predicate
.
Each event handler is called for each item in the CollectionView to determine if it should be displayed or not.
Also, the addition or removal of event handlers from the Filter property will cause the event handlers to be called and the collection updated.
So the correct code for wiring up the Filter event handlers is:
eventsViewSource.Filter += new FilterEventHandler(rmaFilter);
And to remove it:
eventsViewSource.Filter -= new FilterEventHandler(rmaFilter);
And the new handler:
public void rmaFilter(object sender, FilterEventArgs args)
{
args.Accepted = args.Item is RmaType;
}