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

Filtering

RadListControl can filter which items to be currently visible by using the Filter or FilterExpression properties.

Filtering predicate

The Filter property accepts a predicate method that can be used for arbitrary filtering conditions. The FilterExpession property accepts a string following a special syntax that describes which items should be visible. The Filter property is used like this:

Filtering method body

private bool FilterMethod(RadListDataItem itemToFilter)
{
    return itemToFilter.Text.EndsWith("SomeString");
}

Private Function FilterMethod(ByVal itemToFilter As RadListDataItem) As Boolean
    Return itemToFilter.Text.EndsWith("SomeString")
End Function

Setting the Filter property

radListControl1.Filter = FilterMethod;

radListControl1.Filter = AddressOf FilterMethod

Setting the Filter property will start a filtering operation which will call the FilterMethod for every item in RadListControl to determine if the item should be visible or not. After filtering, RadListControl will contain the same number of items as before or less. Setting the Filter property to null resets any filtering and all items will be visible.

Filtering may change the SelectedIndex property depending on whether the currently selected item is still visible.

FilterExpression

Another option to filter the items is to specify the FilterExpression property.

Setting the FilterExpression property

this.radListControl1.FilterExpression = "Country LIKE 'Argentina'";

Me.radListControl1.FilterExpression = "Country LIKE 'Argentina'"

The RadListControl.FilterExpression property value resembles a SQL expression.

In this article