Back to Devexpress

DxAccordion.CustomFilter Property

blazor-devexpress-dot-blazor-dot-dxaccordion-c2bfeb07.md

latest2.1 KB
Original Source

DxAccordion.CustomFilter Property

Allows you to implement custom filter logic.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

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

Property Value

TypeDescription
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;
    }
    @* ... *@
}

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

DxAccordion Class

DxAccordion Members

DevExpress.Blazor Namespace