I've implemented custom filtering based on the how-to article in the KB, but I see this odd behavior where, after clearing the last checkbox in my filter, the filter control appears to still run the PassesFilter logic, resulting in 0 matches, and the column header still has the visual treatment indicating that it is filtered. What I'd like to do is have an un-check of the last item in a filter behave as if the user has clicked the 'Clear Filter' button.
I've tried several things and havethe following conclusions:
- The custom filter is applied to the column when the CommandId.FilterButtonTap command executes, but the Clear button executes CommandId.FilterRequested, so if I want to reset the filter I'd need to do so in my custom GridFilterRequestedCommand
- IsFiltering and Descriptor are both read-only properties on the FilterRequestContext in CommandId.FilterRequested so I can't try to set the first to false or null the second
- It looks like the Clear Filters button removes the FilterDescriptor from the owner, but this didn't make any difference when I tried it because I can't un-set IsFiltering
- I can't create my own FilterRequestedContext to fake an invocation because of the internal sets on all the properties
- WPF appears to have a ClearFilters method which UWP lacks
I'm hoping there's some way to hack around these shortcomings. I also think that a CommandId.FilterRequested should be able to notify the Grid column filter that there are no items chosen to filter on, and that the column should act as if the filter has been cleared.