[]
The DataFilter control supports four different kinds of filters namely, BoolFilter, RangeFilter, DateRangeFilter and ChecklistFilter, to filter different types of data. Corresponding to each filter, an accordion tab is added to the DataFilter control which contains the controls used to filter the data-aware control by a specific field.

The section below gives a brief idea about different types of filters supported by DataFilter control.
When the AutoGenerateFilters property of the C1DataFilter class is set to true, filters are automatically generated depending on the type of the fields present in the DataSource. These filters are added to the FilterCollection and can be accessed using Filters property of the C1DataFilter class.
The following code demonstrates how filters can be automatically generated in the DataFilter control:
vbnet
'Setting AutoGenerateFilters to true generates the filters automatically.
c1DataFilter.AutoGenerateFilters = True
c1DataFilter.ItemsSource = _products
c1DataFilter.ToolTip = True
csharp
//Setting AutoGenerateFilters to true generates the filters automatically.
c1DataFilter.AutoGenerateFilters = true;
c1DataFilter.ItemsSource = _products;
c1DataFilter.ToolTip = true;
To add filters programmatically to the DataFilter control, follow these steps:
The following code demonstrates how to add a RangeFilter to the DataFilter control through code:
vbnet
'Add RangeFilter
Dim rangeFilter As RangeFilter = New RangeFilter("UnitPrice")
'Set text for the header
rangeFilter.HeaderText = "Unit Price"
'Set minimum and maximum values for the RangeFilter
rangeFilter.Minimum = 0
rangeFilter.Maximum = 100
'Specify the type of editor
rangeFilter.EditorsType = C1.DataFilter.EditorsType.SpinEditor
'Show the editor
rangeFilter.EditorsVisible = True
'Sets text of the ToolTip to appear on the filter header
rangeFilter.ToolTip = "Select the price range to perform " +
"filtering on the grid"
'Add filter to the DataFilter control
c1DataFilter.Filters.Add(rangeFilter)
csharp
//Add RangeFilter
RangeFilter rangeFilter = new C1.WPF.DataFilter.RangeFilter("Price");
//Set text for the header
rangeFilter.HeaderText = "Price";
//Set minimum and maximum values for the RangeFilter
rangeFilter.Minimum = 0;
rangeFilter.Maximum = 100;
//Specify the type of editor
rangeFilter.EditorsType = C1.DataFilter.EditorsType.SpinEditor;
//Show the editor
rangeFilter.EditorsVisible = true;
//Sets text of the ToolTip to appear on the filter header
rangeFilter.ToolTip = "Select the price range to perform " +
"filtering on the grid";
//Add filter to the DataFilter control
c1DataFilter.Filters.Add(rangeFilter);
In WPF DataFilter .NET version, the filters can be specified using XAML code as shown in the code snippet below.
<c1:C1DataFilter AutoGenerateFilters="False">
<local:MapFilter x:Name="mf" HeaderText="Store" PropertyName="Store.ID" />
<local:ModelFilter x:Name="mdf" HeaderText="Model" PropertyName="Car.Model"/>
<local:PriceFilter x:Name="pf" HeaderText="Price" PropertyName="Car.Price" ShowSelectAll="False" ShowSearchBox="False"/>
<local:TransmissionFilter x:Name="tf" PropertyName="Car.TransmissAutomatic" HeaderText="Automatic transmission"/>
<local:ColorFilter x:Name="cf" HeaderText="Color" PropertyName="Color"/>
</c1:C1DataFilter>
You can search data in DataFilter control using the full text filtering feature wherein the data source is filtered based on the user input to return the search results. You can use the FullTextFilter class to implement the text filter feature. You can customize the filtering behavior using the MatchCase and MatchWholeWord properties which allow you to filter data by matching case and whole word.
The following GIF below demonstrates a simple text filter that lets you type the value you want to search in the DataFilter. Here, when you type “BMW” in the Filter text box, it filters the data to display all values related to “BMW” brand.

The following markup adds a full text filter and filter across the “Brand” column in the data.
<c1:C1DataFilter x:Name="c1DataFilter" AutoGenerateFilters="False" Grid.ColumnSpan="3" Margin="0,0,533,0">
<c1:C1DataFilter.Filters>
<c1:FullTextFilter PropertyName="Brand" HeaderText="Brand" MatchCase="True" MatchWholeWord="True" />
</c1:C1DataFilter.Filters>
</c1:C1DataFilter>
type=note
Note: This feature is only supported in .NET edition for now.
In order to filter large amount of data and get the specific value with certain criteria, DataFilter allows users to create conditional filter for the whole data. You can use the conditional filter to filter the data that meets two or more complex criteria such as extracting matches and differences between data.
The following GIF below demonstrates a conditional filtering applied to DataFilter control.

The following markup adds conditional filter and filters the data in the DataFilter control.
<c1:C1DataFilter x:Name="c1DataFilter" AutoGenerateFilters="False" Grid.ColumnSpan="3" Margin="0,0,533,0">
<c1:C1DataFilter.Filters>
<c1:TextFilter PropertyName="Brand" />
<c1:DateFilter PropertyName="DateProductionLine" HeaderText="Date Production Line" />
<c1:NumericFilter PropertyName="Price" Increment="1000" Format="F2" />
</c1:C1DataFilter.Filters>
</c1:C1DataFilter>
type=note
Note: This feature is only supported in .NET edition for now.