2X faster development
The ultimate WPF UI toolkit to boost your development speed.
Filters applied to SfDataGrid can be cleared by calling SfDataGrid.ClearFilters. As the requirement is to clear filter using HeaderContextMenu, define ContextMenu for Header using SfDataGrid.HeaderContextMenu property. In the following XAML code, the ContextMenu is defined with one MenuItem for HeaderContextMenu. XAML The Command property in MenuItem is bound with the ContextMenuCommand.ClearFiltering command that is defined in the code example. The following code example is for ContextMenuCommands static class with ClearFiltering command property in it. MenuItem in HeaderContextMenu gets the GridColumnContextMenuInfo as command parameter, when the action is triggered. GridColumnContextMenuInfo has the following properties, from which you can clear the filters for particular column or for the all GridColumns.
In the following ClearFiltering action, the filters are cleared for all columns by using SfDataGrid.ClearFilters() method. C# Now, you can see ContexMenu when you right click on the column header of SfDataGrid, as in the following screenshot.
You can refer the sample from the following location, |
2X faster development
The ultimate WPF UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.