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

Descriptor items

There are two item types that are currently supported:

  • DataFilterDescriptorItem: The default item that uses filter value editor according to the data type of the field.
  • DataFilterComboDescriptorItem: Uses a RadDropDownList for setting the filter value and allows the user to choose from a predefined set of values.

Common Properties

This section shows the common descriptor items properties.

Property Description
DefaultValue This value will be used as filter value when a new descriptor is added.
FilterOperators Gives you access to the list of the available filter operators.
DefaultFilterOperator Set the filter operator of a newly added descriptor.
DescriptorName Gets or sets the name of the descriptor
DescriptorType Indicates the data type used for this descriptor.

The DefaultFilterOperator property accepts only valid operators for the specified type of the descriptor item. If an invalid operator is set, an exception will be thrown.

You can find in the table below all available filter operators for the common types:

Type Valid Operators
Numeric Types Equals, Not equal to, Greater than, Less than, Greater than or equal to, Less than or equal to, Is null, Is not null
String Contains, Does not contain, Starts with, Ends with, Is in list, Not in list, Equals, Not equal to, Is null, Is not null
DateTime Equals, Not equal to, Greater than, Less than, Greater than or equal to, Less than or equal to, Is null, Is not null
Bool Equals, Not equal to, Is null, Is not null

RadDataFilter also exposes the PropertyDisplayNameNeeded event which allows a user-friendly name to be specified instead of the default names which are extracted from the fields.

The following article shows how you can manually add DataFilterDescriptorItem: Unbound Mode

DataFilterComboDescriptorItem

This item is auto-generated only if the data type of the underling field is of type "enum". If you want to use such item for a other data field you need to add it manually. This can be achieved at design time or by adding the item in the code. In both cases you need to specify the fooling properties:

  • DataSoure: The source for the items displayed in the RadDropDownList.
  • DisplayMemeber: The field whose values should be displayed in the RadDropDownList.
  • ValueMember: The field whose values should be used for the filter expression.

Adding DataFilterComboDescriptorItem at design time

The RadItem Collection Editor that allows you to edit the items at design time can be shown either via the Smart Tag or by the Descriptors property in the Properties section in Visual Studio. It allows you add/remove/modify the items.

Figure 1: Adding DataFilterComboDescriptorItem at design time

WinForms RadDataFilter Adding DataFilterComboDescriptorItem at design time

Adding DataFilterComboDescriptorItem programmatically

The following snippet shows how you can add DataFilterComboDescriptorItem in the code:

DataFilterComboDescriptorItem item1 = new DataFilterComboDescriptorItem();
item1.DescriptorName = "Item Type";
item1.DescriptorType = typeof(int);
item1.DataSource = GetTable();
item1.ValueMember = "ID";
item1.DisplayMember = "Type";
item1.DropDownStyle = RadDropDownStyle.DropDown;
item1.AutoCompleteMode = AutoCompleteMode.Suggest;
radDataFilter1.Descriptors.Add(item1);

Dim item1 As New DataFilterComboDescriptorItem()
item1.DescriptorName = "Item Type"
item1.DescriptorType = GetType(Integer)
item1.DataSource = GetTable()
item1.ValueMember = "ID"
item1.DisplayMember = "Type"
item1.DropDownStyle = RadDropDownStyle.DropDown
item1.AutoCompleteMode = AutoCompleteMode.Suggest
RadDataFilter1.Descriptors.Add(item1)

When this is done you can add new expression item and choose from the list:

Figure 2: DataFilterComboDescriptorItem at runtime.

WinForms RadDataFilter DataFilterComboDescriptorItem at Runtime

See Also

In this article