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

Overview

RadDataGrid provides built-in filtering functionality, that allows the user to easily filter data by one or more columns. Everything that can be achieved by the end user through the UI can also be done in code by using the API exposed by the control.

Filtering UI

The built-in Filtering UI allows the user to easily filter data by column values. The filtering functionality will be enabled out-of-the-box for most .NET primitive types such as strings, numeric types, DateTimes and so on.

DataGrid Filtering UI

As can be seen in the image above, the default filtering UI consists of two parts - a distinct filters list and two field filters.

If you want to hide the top part of this UI (the distinct values) for a particular column, you can set the ShowDistinctValuesFilter property of the respective column to False.

Example 1: Hide the distinct values list

<grid:DataGridTextColumn PropertyName="City" ShowDistinctValuesFilter="False" /> 
You can also use the UserFilterMode property of the RadDataGrid to enable or disable the filtering UI as a whole.

Example 2: Disable the filtering functionality

<grid:RadDataGrid UserFilterMode="Disabled" /> 
To enable or disable the filtering of a specific column you can use the CanUserFilter property of that column.

Example 3: Disable the filtering functionality of a column

<grid:DataGridTextColumn PropertyName="City" CanUserFilter="False" /> 

Filtering Modes

There are two filter modes that depend on the value of the ColumnDataOperationsMode property of the RadDataGrid.

  • Inline Filter UI: The ColumnDataOperationsMode is set to Inline. The Filter UI is integrated in the column header and is represented by a filtering funnel which can be clicked to open the filtering popup. This is the default behavior.

    Figure 1: Inline ColumnDataOperationsMode

    Inline ColumnDataOperationsMode

  • Flyout Filter UI: The ColumnDataOperationsMode is set to Flyout. The Filter UI is displayed with slide animation from the top of the grid. To open it, click the column's header cell.

    Figure 2: Column Data Operations Menu

    Flyout ColumnDataOperationsMode 1

    If you then click on the Filter button, you will be presented with the filtering flyout.

    Figure 3: Flyout ColumnDataOperationsMode

    Flyout ColumnDataOperationsMode 2

Example 4: Setting the ColumnDataOperationsMode

<grid:RadDataGrid ColumnDataOperationsMode="Flyout" /> 

Programmatic Filtering

RadDataGrid also allows for programmatic filtering through adding FilterDescriptors to its FilterDescriptors collection.

See Also

In this article
Not finding the help you need?