wpfxceed-datagrid

Reset Filter on xceed datagrid using a button


I have a filtering row in my xceed datagrid. There are around 8 columns. The user can enter the filter criteria for each column.

Now what I want to do is reset the whole filter using a single button.

Any ideas would be appreciated


Solution

  • Okay I figured it out. I simply created a command ClearFilterCommand in my ViewModel whose execute method is ClearFilter

    private void ClearFilter (object obj)
    {
      if (obj != null && obj is DataGridControl)
        DataGridCommands.ClearFilter.Execute (null, obj as DataGridControl);
    }
    
    <Button Content="Clear Grid Filter" Command="{Binding ClearFilterCommand}" CommandParameter="{Binding ElementName=xceedgrid}"/>
    

    xceedgrid is the name of my xceed DataGrid in the xaml.