Filtering

The RadTreeListView provides you with a built-in filtering functionality, which allows the user to easily filter the data by one or more columns.

Clicking the filtering icon in the column headers opens a menu with the distinct values for the current column and the user can select which of these values to be displayed. The user can also enter a filter criterion in the filter box. A drop-down list allows for selecting a filter expression that is applied to the criterion for the column. The case sensitivity can also be specified via a check box. When the user presses the filter button, the grid displays only the records matching the filter criteria specified by using the filter boxes.

Only the values at the highest level of the hierarchy are included in the distinct filter list.

In order to filter TreeListView's low level nodes directly through the distinct values listbox, you can manually set its ItemsSource. Just subscribe to the DistinctValuesLoading event of TreeListView and set the e.ItemsSource to the collection you want to show.

Example 1: Setting the ItemsSource of the GridViewDistinctValuesLoadingEventArgs

private void radTreeListView_DistinctValuesLoading(object sender, GridView.GridViewDistinctValuesLoadingEventArgs e) 
{ 
    e.ItemsSource = WarehouseService.GetNames(); 
} 

As the RadTreeListView directly inherits the RadGridView it uses its filtering mechanism. The RadGridView allows you to implement programmatic filtering, custom filtering and more. To learn more read the respective topics in the RadGridView's documentation.

Utilizing the AutoExpandItemsAfterFilter property

Since R2 2018 SP1 you have the option to prevent the expanding of the RadTreeListView items after it is filtered. You can do that by setting the AutoExpandItemsAfterFilter property to False. The default value of the property is True which keeps the previous behavior of expanding all items after filtering.

Example 2: Setting the AutoExpandItemsAfterFilter property

 <telerik:RadTreeListView AutoExpandItemsAfterFilter="False" > 

See Also

In this article