New to Telerik UI for WPF? Download free 30-day trial

Pre-Check Distinct Values CheckBoxes in FilteringControl of RadGridView

Environment

Product Version
Product RadGridView for WPF

Description

How to manually check options in the distinct values list of the FilteringControl of a column.

Solution

The following example shows how to pre-select options from the list of the distinct values of a column on loading of RadGridView. One way to do this is to subscribe to the Loaded event of RadGridView and get the ColumnFilterDescriptor of the column where the distinct values should be checked. Then use the AddDistinctValue method of the DistinctFilter as shown in the Programmatic Filtering article.

private void RadGridView_Loaded(object sender, RoutedEventArgs e) 
{ 
    GridViewColumn column = this.gridView.Columns["City"]; 
    IColumnFilterDescriptor filterDescriptor = column.ColumnFilterDescriptor; 
    filterDescriptor.DistinctFilter.AddDistinctValue("Sofia"); 
    filterDescriptor.DistinctFilter.AddDistinctValue("London"); 
    filterDescriptor.DistinctFilter.AddDistinctValue("Seattle"); 
} 
In this article