Skip to main content

Filtering

  • 2 minutes to read

ListBoxEdit and LookUpEditBase descendants (ComboBoxEdit, LookUpEdit, FontEdit) provide built-in data filtering functionality. This topic describes the approaches to configure this feature.

Filter Values With Filter Criteria

ListBoxEdit and LookUpEditBase descendant editors can apply filter criteria to the bound collection, which prevents the display and selection of specific items.

In XAML

<dxe:ComboBoxEdit x:Name="editor" 
                  DisplayMember="Name" 
                  FilterCriteria="[IsEnabled]=true"/>

In Code

public class Item {
    public string Name { get; set; }
    public bool IsEnabled { get; set; }
}
//...
editor.ItemsSource = new List<Item> {
    new Item { Name = "A", IsEnabled = true },
    new Item { Name = "B", IsEnabled = true },
    new Item { Name = "C" },
};
editor.FilterCriteria = CriteriaOperator.Parse("[IsEnabled]=?", true);

Incremental Filtering

The LookUpEditBase descendant editors can automatically filter drop-down items based on entered text.

To enable this mode, set the LookUpEditBase.IncrementalFiltering or LookUpEditSettingsBase.IncrementalFiltering property to true. Set the FilterCondition and IsCaseSensitiveFilter properties to change the applied filter condition.

Note

When the editor’s LookUpEditBase.DisplayMember/LookUpEditBase.ValueMember properties are defined, an end-user can select only objects from the ItemsSource collection. To allow end-users to type in the edit box, set the LookUpEditBase.AutoComplete property to true and/or BaseEdit.ValidateOnTextInput property to false.

Substitute Display Filter

Incremental filtering works with the displayed values of data items (defined by the DisplayMember property value). If the DisplayMember property is null or empty, a filter condition is applied to the entire item.

LookUpEditBase descendant editors allow you to customize an applied filter condition, for example, to filter by the value member instead of the displayed member. Handle the SubstituteDisplayFilter event to do this.

See Also