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

RadGridView Column Filtering Enum Values

Environment

Product Version 2023.2.718
Product RadGridView for WPF

Description

How to filter Enum values in GridView column and display all of them in the distinct value filter.

Solution

You can use the DistinctValuesLoading event of RadGridView.

private void RadGridView_DistinctValuesLoading(object sender,   Telerik.Windows.Controls.GridView.GridViewDistinctValuesLoadingEventArgs e) 
{ 
    var dataColumn = e.Column as GridViewBoundColumnBase; 
    if (dataColumn != null && dataColumn.DataType.IsEnum) 
    { 
        e.ItemsSource = Enum.GetValues(dataColumn.DataType); 
    } 
} 
In this article