ComponentOne FlexGrid for WPF and Silverlight
Search Data using Full Text Filter
Features > Data Filtering > Search Data using Full Text Filter

You can search data in FlexGrid using full text filtering feature wherein the grid's data source is filtered based on the user input to return the search results. The C1FullTextFilter class helps to implement this feature. The FilterEntry property of this class associates a text box with the FlexGrid control. As soon as the user inputs a value in this text box, the FlexGrid control is filtered. However, you can alter this behavior to filter the text after entering complete value using Mode property of the C1FullTextFilter class, which accepts values from the FullTextFilterMode enumeration.

By default, filtering is applied to the data source of FlexGrid. In case a CollectionView is used as FlexGrid's data source, filtering is applied to the CollectionView, and this impacts all the controls bound to the same CollectionView. However, you can change this behavior by setting the UseCollectionView property to false.

Moreover, you can customize the filtering behavior using the MatchCase, MatchNumbers, MatchWholeWord or TreatSpacesAsAndOperator properties which allow you to filter data by matching case, whole word, number or treat space as AND operator respectively. In addition, you can also specify the delay time used to filter after the last typed character using the Delay property.

In XAML

The following markup binds a text box to search and filter across all columns on the grid:

Markup
Copy Code
<TextBox x:Name="filter" Margin="0, 40, 0, 0"/> <c1:C1FlexGrid Name="grid" Grid.Row="1"> <c1:C1FlexGridFilterService.FlexGridFilter> <c1:C1FlexGridFilter /> </c1:C1FlexGridFilterService.FlexGridFilter> <c1:C1FlexGridFilterService.FullTextFilterBehavior> <c1:C1FullTextFilter FilterEntry="{Binding Source={x:Reference filter}}" MatchCase="True"/> </c1:C1FlexGridFilterService.FullTextFilterBehavior> </c1:C1FlexGrid>

In Code

The following code sets the entry field and performs search and filtering across all columns on the grid:

Dim ftf As C1FullTextFilter = New C1FullTextFilter(grid)
ftf.FilterEntry = filter
ftf.MatchCase = True
ftf.Mode = C1FullTextFilter.FullTextFilterMode.WhenCompleted
C1FullTextFilter ftf = new C1FullTextFilter(grid);
ftf.FilterEntry = filter;
ftf.MatchCase = true;
ftf.Mode = C1FullTextFilter.FullTextFilterMode.WhenCompleted;