Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxAccordion.CustomFilter Property

Allows you to implement custom filter logic.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[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:

razor
<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