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

End-user Functionality

RadDataFilter allows you to create complex filter criteria with unlimited number of filter conditions combined by logical operators. The following article will show you how to create filter expressions. Start with the first section which shows how you can add filter conditions. The second section explains how you can combine the conditions.

Adding Expressions

To create a filter condition you need to define the Column/Field, the operator (AND or OR) and the Value. For instance, 'Quantity > 200' is a simple filter condition, where the Quantity is a column/field name, '>' is the "greater than" operator and '200' is the value. Here is how to create this condition using the RadDataFilter user interface.

  1. If no filtering has been applied, RadDataFilter will contain the root operator only. WinForms RadDataFilter Root Operator

  2. To add your first filter criteria - click the Add button and select Expression. It will create a new row with several elements.

    WinForms RadDataFilter Add Expression

  3. Once the expression item is added you need to set the column/field, the operator and the value.

    WinForms RadDataFilter Set the Column/Field

The first drop down contains all the data fields/columns of the data source, to which RadDataFilter is bound. They are automatically populated, so you do not need to do any code to get them. The second drop down shows the available logical operators that could be applied against the type of the selected field. For example, the text field will have the Contains or Starts With operators, while the DateTime field will have Is Greater Than operators.

Adding Groups

The groups allow you to define the relation between the conditions or groups inside it. There are two possible values that can be used as a group operator - All and Any. If the All operator is used all the conditions within the group must be fulfilled in order the entry to pass the filter condition. If the Any operator is used the entry must fulfill only one of the conditions.

By default, the control always has one root group that can contain expressions or other groups.

The following example shows a single group with two filter expressions in it. If the first OR the second condition are met the entry will fulfill the criteria. WinForms RadDataFilter Adding Groups

If you change the condition all the filter expressions must be fulfilled. Here is an example for this as well. WinForms RadDataFilter Change the Condition All the Filter Expressions

Drag and Drop

RadDataFilter natively supports drag and drop allowing the end users to perform easy modifications of the visual tree. The drag and drop operation will also change the control`s expression.

WinForms RadDataFilter Drag and Drop

RadDataFilter extends the drag and drop functionality provided by RadTreeView. Detailed information on how the drag-drop service is working is available here.

See Also

In this article