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.v20.1.dll

Declaration

public event EventHandler<SubstituteDisplayFilterEventArgs> SubstituteDisplayFilter
Public Event SubstituteDisplayFilter As EventHandler(Of SubstituteDisplayFilterEventArgs)

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:

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;
} 
See Also