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

Filtering

RadMultiColumnComboBox supports auto-complete option with suggesting the available result records. This is achieved by the filtering functionality that RadGridView supports.

The built-in filtering mechanism relies on the field names of the columns in the underlying grid. The property name of an applied filter descriptor needs to match the FieldName property of an existing column in the grid.

Using Simple FilterDescriptors

Filtering operation in RadMultiColumnComboBox is controlled by the Boolean AutoFilter property. The data is filtered by the field specified as DisplayMember. In addition, you should set the filter expression (notifying the control about the rules it should use to filter the data) and add that expression to the MasterTemplate.

Please note that by default the FilterDescriptor.Value is an empty string and it should remain with this value.

FilterDescriptor


this.radMultiColumnComboBox1.AutoFilter = true;
this.radMultiColumnComboBox1.DisplayMember = "ContactName";
FilterDescriptor filter = new FilterDescriptor();
filter.PropertyName = this.radMultiColumnComboBox1.DisplayMember;
filter.Operator = FilterOperator.Contains;
this.radMultiColumnComboBox1.EditorControl.MasterTemplate.FilterDescriptors.Add(filter);

Me.RadMultiColumnComboBox1.AutoFilter = True
Me.RadMultiColumnComboBox1.DisplayMember = "ContactName"
Dim filter As New FilterDescriptor()
filter.PropertyName = Me.RadMultiColumnComboBox1.DisplayMember
filter.Operator = FilterOperator.Contains
Me.RadMultiColumnComboBox1.EditorControl.MasterTemplate.FilterDescriptors.Add(filter)

The code snippet above will result in the following multi-column combobox:

Figure 1: Basic filtering

WinForms RadMultiColumnComboBox Basic filtering

Using CompositeFilterDescriptor

You can filter data records by multiple values. For this purpose you have to use the CompositeFilterDescriptor object. It contains a collection of filter descriptors objects and the logical operator for that filters.

Figure 2: Filtering with CompositeFilterDescriptors

WinForms RadMultiColumnComboBox Filtering with CompositeFilterDescriptors

this.radMultiColumnComboBox1.AutoFilter = true;
CompositeFilterDescriptor compositeFilter = new CompositeFilterDescriptor();           
FilterDescriptor prodName = new FilterDescriptor("ProductName", FilterOperator.Contains, "");
FilterDescriptor prodQuantity = new FilterDescriptor("QuantityPerUnit", FilterOperator.Contains, "");
compositeFilter.FilterDescriptors.Add(prodName);
compositeFilter.FilterDescriptors.Add(prodQuantity);
compositeFilter.LogicalOperator = FilterLogicalOperator.Or;
this.radMultiColumnComboBox1.EditorControl.FilterDescriptors.Add(compositeFilter);

Me.radMultiColumnComboBox1.AutoFilter = True
Dim compositeFilter As New CompositeFilterDescriptor()
Dim prodName As New FilterDescriptor("ProductName", FilterOperator.Contains, "")
Dim prodQuantity As New FilterDescriptor("QuantityPerUnit", FilterOperator.Contains, "")
compositeFilter.FilterDescriptors.Add(prodName)
compositeFilter.FilterDescriptors.Add(prodQuantity)
compositeFilter.LogicalOperator = FilterLogicalOperator.[Or]
Me.radMultiColumnComboBox1.EditorControl.FilterDescriptors.Add(compositeFilter)

The composite filters allow you to create more complex filtering expressions. Note that this feature is supported for text columns only as the RadMultiColumnComboBox has one common text input for the filtering operation and it is not possible to convert input data to different data formats automatically.

See Also

In this article