Filtering the data by distinct value using the filter query optimization doesn't work properly when adding more than 500 distinct values. To reproduce this, set the OptimizeDistinctFilterQuery property of the corresponding column to True. The distinct values should be filtered using the ColumnFilterDescriptor and the AddDistinctValue method of the DistinctFilter.
In that case, the filter can get reversed and remove the selected distinct values from the data view, instead of adding only them, as would be expected. Or the filter can stop working at all and display all values from the ItemsSource.
To work this around, instead of using the ColumnFilterDescriptor and the AddDistinctValue method, add a composite filter descriptor manually in the FilterDescriptors of RadGridView.
radGridView.FilterDescriptors.SuspendNotifications();
var distinctValuesFilter = new CompositeFilterDescriptor();
distinctValuesFilter.LogicalOperator = FilterCompositionLogicalOperator.Or;
for (int i = 0; i < 5000; i++)
{
object disctincValue = i;
var filter = new FilterDescriptor("Id", FilterOperator.IsEqualTo, disctincValue);
distinctValuesFilter.FilterDescriptors.Add(filter);
}
radGridView.FilterDescriptors.Add(distinctValuesFilter);
radGridView.FilterDescriptors.ResumeNotifications();