The GridTreeControl does not provide direct support to filter a record. To filter a record, you can use the Filter predicate in the . By using the ICollectionView type as itemssource to the GridTreeControl, you can filter the records in the ICollectionView. So, the records that satisfy the given condition will be displayed in the GridTreeControl.
You can refer to the following code example to use the ICollectionView.
You can refer to the following code example to define the GridTreeControl in XAML.
Records in the GridTreeControl can be filtered with the help of the Filter Predicate in the ICollectionView. Refer to the following code example to filter the record by using the Filter Predicate.
In the following screenshot, the default view of the Grid is displayed.
Figure 1: Default view of grid
The following screenshot displays the entered text (“Blue”) in the textbox is filtered in the Grid.
Figure 2: Entered text filtered in a grid
You can filter the Grid by entering the text in the search textbox. On clicking the ApplyFilter button, the FilterValueMethod command in the viewmodel is invoked. In this command, the CollectionView is refreshed by using the Refresh method and while refreshing the CollectionView, the Filter Predicate is fired and the records are filtered based on the FilterString that holds the text in the search textbox. Finally, the GridTreeControl is redrawn by using the ResetDisplay method.
You can refer to the following code example to call the Refresh method in the CollectionView and ResetDisplay method in the GridTreeControl.
You can refer to the following sample links to filter a records in GridTreeControl for WPF platforms.
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|