Edit this page


RadListView allows filtering operations in all views. To enable filtering operations use the EnableFiltering property of the control:

Enable filtering

radListView1.EnableFiltering = true;

RadListView1.EnableFiltering = True

Once the filtering is enabled, we have to create a new FilterDescriptor and assign its PropertyName, FilterOperator and SearchCriteria. First, let’s filter the items by their value and look for items starting with “Local”.

Filter by value

FilterDescriptor valueFilter = new FilterDescriptor("Value", FilterOperator.StartsWith, "Local");

Dim valueFilter As New FilterDescriptor("Value", FilterOperator.StartsWith, "Local")

Before filtering After filtering
listview-features-filtering 001 listview-features-filtering 003

When a column name is specified as PropertyName of the filter descriptor, RadListView will filter by the values of the specified column:

Filter by type

FilterDescriptor typeFilter = new FilterDescriptor("Type", FilterOperator.Contains, "Disk");

Dim typeFilter As New FilterDescriptor("Type", FilterOperator.Contains, "Disk")

Before After
listview-features-filtering 002 listview-features-filtering 004

Custom Filtering

RadListView provides a flexible mechanism for defining a custom filtering logic by using a custom filter predicate. The following example demonstartes how to apply a FilterPredicate in order to filter all items which contain "C":

Custom FilterPredicate

private bool MyFilter(ListViewDataItem item)
    if (item.Value.ToString().Contains("C"))
        return true;
    return false;

Private Function MyFilter(item As ListViewDataItem) As Boolean
    If item.Value.ToString().Contains("C") Then
        Return True
    End If
    Return False
End Function

Apply the custom FilterPredicate

this.radListView1.ListViewElement.DataView.Filter = MyFilter;

Me.RadListView1.ListViewElement.DataView.Filter = AddressOf MyFilter

Figure 3: Custom filtering

listview-features-filtering 005

See Also

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article