blazor-devexpress-dot-blazor-dot-dxaccordion-c2bfeb07.md
Allows you to implement custom filter logic.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
[Parameter]
public Func<IAccordionItemInfo, bool> CustomFilter { get; set; }
| Type | Description |
|---|---|
| Func<IAccordionItemInfo, Boolean> |
A method defined by the Func<IAccordionItemInfo, bool> signature.
|
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;
}
@* ... *@
}
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