-3

I want on button click whatever filters are applied on some columns in my wpf xam data grid should clear off. I want something like

recordfilter.clear()

but i cannot use it outside RecordFilterChanged event So if i could do something like this on button click event that would solve my case.

Rockerz
  • 31
  • 7
  • 4
    Please show some of your code and explain where you got stuck. (Who voted this question up?) – diiN__________ Apr 22 '16 at 12:06
  • 1
    Please read the updated question now – Rockerz Apr 22 '16 at 12:12
  • Hi, Unfortunately the information that you have provided is not enough to reproduce your scenario. Would you please share with us how you are doing your custom filtering? Are you using RadGridView.FilterDescriptors.Clear(); when you are programatically clearing the filters? –  Apr 22 '16 at 12:19

1 Answers1

0

Finally i managed to resolve this issue by creating Behaviour of xamDataGrid. Following code resolved my issue

public static readonly DependencyProperty IsFiltersClearedProperty = DependencyProperty.Register("IsFiltersCleared", typeof(bool), typeof(XamDataGridClearFilters), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, ClearFilters));



 public bool IsFiltersCleared
        {
            get { return (bool)GetValue(IsFiltersClearedProperty); }
            set { SetValue(IsFiltersClearedProperty, value); }
        }
    private static void ClearFilters(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        if (!(bool)e.NewValue)
        {
            return;
        }
        XamDataGridClearFilters gridExtender = (XamDataGridClearFilters)d;
        XamDataGrid dataGrid = (XamDataGrid)gridExtender.AssociatedObject;
        dataGrid.ClearCustomizations(CustomizationType.RecordFilters);
        gridExtender.IsFiltersCleared = false;
    }

}
Rockerz
  • 31
  • 7