We have this sort of filter
private CompositeFilterDescriptor _deletedNewFilterDescriptor = new CompositeFilterDescriptor()
{
LogicalOperator = FilterCompositionLogicalOperator.Or,
FilterDescriptors =
{
new FilterDescriptor("Column1", FilterOperator.IsNotEqualTo, "MyState"),
new FilterDescriptor("Column2", FilterOperator.IsNotEqualTo, "YourState")
}
};
and at some point when we refresh the grid, the rows that should be filtered get displayed. So we have to do something like this which also fails on occasions
void grd_loaded(object sender, RoutedEventArgs e)
{
// For some reason, adding filters in constructors gets cleared somewhere, so add in Loaded methods.
if (!grd.FilterDescriptors.Contains(_deletedNewFilterDescriptor))
grd.FilterDescriptors.Add(_deletedNewFilterDescriptor);
}
Any help would be appreciated. Because we will have to filter those rows at the SQL fetching time and not afterwards. This means changing the existing code.