Skip to main content

LookUpEditBase.SubstituteDisplayFilter Event

Allows you to customize the filter applied by LookUpEdit or ComboBoxEdit (for example, to filter data by an additional/another column).

Namespace: DevExpress.Xpf.Editors

Assembly: DevExpress.Xpf.Core.v24.2.dll

NuGet Package: DevExpress.Wpf.Core

Declaration

public event EventHandler<SubstituteDisplayFilterEventArgs> SubstituteDisplayFilter

Event Data

The SubstituteDisplayFilter event's data class is DevExpress.Xpf.Editors.Helpers.SubstituteDisplayFilterEventArgs.

Remarks

In the code sample below, an editor filters items by FirstName with the following configuration:

<dxg:LookUpEdit DisplayMember="FirstName" .../> 
public class Person {
    public string FirstName { get; set; }
    public string LastName { get; set; }
} 

To filter items by both FirstName and LastName, add a corresponding condition in the SubstituteDisplayFilter event handler:

View Example: Filter the LookUpEdit by Multiple Columns

void SubstituteDisplayFilter(object sender, SubstituteDisplayFilterEventArgs e) {
    if (string.IsNullOrEmpty(e.DisplayText))
        return;
    var extraFilter = CriteriaOperator.Parse("StartsWith(LastName,?)", e.DisplayText);
    e.DisplayFilter = new GroupOperator(GroupOperatorType.Or, extraFilter, e.DisplayFilter);
    e.Handled = true;
} 

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SubstituteDisplayFilter event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also