Filtering in Windows Forms ComboBox (SfComboBox)
3 Sep 2020 / 1 minute to read
The SfComboBox support you to filter the items by setting the Filter property of DropDownListView
to a predicate that will be called for every data item to determine whether the item is visible or not.
NOTE
The RefreshFilter() method should be called after the filter predicate set.
//Filter
sfComboBox1.DropDownListView.View.Filter = FilterItem;
sfComboBox1.DropDownListView.View.RefreshFilter();
//Filter predicate
private bool FilterItem(object data)
{
if ((data as USState).LongName.StartsWith("C"))
return true;
return false;
}
'Filter
sfComboBox1.DropDownListView.View.Filter = AddressOf FilterItem
sfComboBox1.DropDownListView.View.RefreshFilter()
'Filter predicate
private Boolean FilterItem(Object data)
If (TryCast(data, USState)).LongName.StartsWith("C") Then
Return True
End If
Return False
Was this page helpful?
Yes
No
Thank you for your feedback!
Thank you for your feedback and comments. We will rectify this as soon as possible!
An unknown error has occurred. Please try again.
Help us improve this page