Skip to main content

DxAccordion.CustomFilter Property

Allows you to implement custom filter logic.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public Func<IAccordionItemInfo, bool> CustomFilter { get; set; }

Property Value

Type Description
Func<IAccordionItemInfo, Boolean>

A method defined by the Func<IAccordionItemInfo, bool> signature.

Remarks

The CustomFilter property allows you to replace the default filter behavior.

The following code maps the word Hat to Cap:

<DxAccordion ShowFilterPanel="true"
             @bind-FilterString=@FilterString
             CustomFilter="@((n) => IsSynonym(n.Text))"
             CssClass="cw-480"
             Data="@Data">
    <DataMappings>
        <DxAccordionDataMapping ParentKey="CategoryId"
                                Key="Id"
                                Text="Name" />
    </DataMappings>
</DxAccordion>

@code {
    string FilterString = "";
    bool IsSynonym(string Text) {
        if (FilterString == "Hat" && Text.Contains("Cap"))
            return true;
        else
            return false;
    }
    @* ... *@
}

Custom filter

Note that you should also implement custom highlight logic if required. Use the HeaderTextTemplate property to do so. Refer to our GitHub example for implementation details.

View Example: Implement Custom Filter

See Also