I have a GridView which is bound to a QueryableCollectionView. The QCV has some filterdescriptors added when created (like filtering on Customer_Id), but it is also possible to add more filter conditions through the UI of the GridView. My customer asked me to add a "Clear all filters" button which should clear all filters added via the UI on GridView. I wrote the following code to clear these filters (VehicleList is the QCV):
01.
using
(
this
.VehicleList.DeferRefresh())
02.
{
03.
// get all filters added to the GridView and remove them
04.
var columnFilterList =
this
.VehicleList.FilterDescriptors.OfType<MemberColumnFilterDescriptor>().ToList();
05.
if
(columnFilterList.Any())
06.
{
07.
foreach
(MemberColumnFilterDescriptor filterCondition
in
columnFilterList)
08.
{
09.
this
.VehicleList.FilterDescriptors.Remove(filterCondition);
10.
}
11.
}
12.
}
The result: all filter-icons on the GridView return to inactive. However, the checkboxes inside the filter-dropdown that have been used to declare the filter condition are still checked! How can I delete all filter conditions via code (it HAS to be done inside a ViewModel, I can not use the GridView directly) and have all checkboxes inside the filter-dropdown unselected??
Regards
Heiko