Silverlight 4 PagedCollectionView with Multiple Filters [duplicate]
I'm new to Silverlight 4 and the PagedCollectionView. I know it's possible to add a filter to a PCV such as
pvc.Filter = new Predicate(FilterProjectId);
Where pvc is a populated PagedCollectionView.
What I need to do is stack multiple filters to a PCV as I've got a search screen with about 6 fields on it and a DataGrid that's bound to the PCV. Depending on what ComboBoxes are selected, when a search button is pressed, I need to filter the PCV results based on those selections.
I can only seem to get it to take the last filter set. Can anyone provide me with information on how to stack them?
Thanks
The Filter property is simply a delegate to a function that takes an object and returns a boolean. That function can be as simple or as complex as you choose to write.
Sounds to me that you just need one function contain a series of if
blocks that compares the object with each of your 6 fields as necessary then returns the result.
The point is there is no "set of filters" that you can "stack" you just write a filter function that does all you need it to do.
精彩评论