wpf - CollectionViewSource Filtering Event vs Property -


what of practical differences between using collectionviewsource.view.filter property opposed collectionviewsource.filter event? there situations use 1 on other or matter of preference?

cheers,
berryl

edit: see docs "if view object comes collectionviewsource object, apply filtering logic setting event handler filter event." although nothing stops setting property on view, , doesn't why so.

the advantage have found far in setting event on collectionviewsource can implement of filtering logic in 1 event handler , use view.refresh (or view.deferrefresh) invoke user changes filtering criteria.

setting filter event in collectionviewsource mean event called when there no filtering needed make process less efficient.

the official way of using filter event adding on filtering , removing later when filter cleared.

viewsource.filter += viewsource_filter;

then:

viewsource.filter -= viewsource_filter; //how know how many events there are!?

if use event, have make sure not adding event each time filter value changes, because apart having redundant events lurking around (=app works harder nothing) have remove events in order clear filter.

thus, there advantage in using filter property, because can more clear filter setting property null.

viewsource.view.filter = null;


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -