We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Clear all filters

Thread ID:

Created:

Updated:

Platform:

Replies:

144661 May 16,2019 09:08 AM UTC May 17,2019 07:35 AM UTC WPF 1
loading
Tags: SfDataGrid
Ondrej Svoboda
Asked On May 16, 2019 09:08 AM UTC

Hi,
is there a way how user can easily clear all filters?
The best solution would be to have new button displayed in GridRowHeaderIndentCell when some filter is set. Clicking it would clear all filters.
Is there a way how to do it?

Thanks
Ondra

Dinesh Babu Yadav [Syncfusion]
Replied On May 17, 2019 07:35 AM UTC

Hi Ondra,             
 
Thanks for using Syncfusion products. 
 
If you want to clear the filtering by clicking on the RowHeaderIndentCell, you can use the ControlTemplate to load the button and wire the click event to perform the clear filter action. Refer to the following code snippet, 
 
Code Snippet: 
Xaml code 
<Style TargetType="syncfusion:GridRowHeaderIndentCell"> 
    <Setter Property="Template"> 
        <Setter.Value> 
            <ControlTemplate TargetType="syncfusion:GridRowHeaderIndentCell"> 
                <Border x:Name="PART_RowHeaderCellBorder" 
                BorderBrush="{TemplateBinding BorderBrush}" 
                BorderThickness="{TemplateBinding BorderThickness}"> 
                    <Grid> 
                        <!--Load the Button to clear the filter --> 
                        <Button Content="x" Click="ClearFilter" /> 
                    </Grid> 
                </Border> 
            </ControlTemplate> 
        </Setter.Value> 
    </Setter> 
</Style> 
 
C#  
private void ClearFilter(object sender, RoutedEventArgs e) 
{ 
    //Clear all the filters from the SfDataGrid. 
    this.sfdatagrid.ClearFilters(); 
} 
 
 
You  can also refer to the following KB document to clear all the column filters by using the context menu, 
 
Regards, 
Dinesh Babu Yadav 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon