blazor-devexpress-dot-blazor-dot-dxtreeview-2ced5b7a.md
Allows you to implement custom filter logic.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
[Parameter]
public Func<ITreeViewNodeInfo, bool> CustomFilter { get; set; }
| Type | Description |
|---|---|
| Func<ITreeViewNodeInfo, Boolean> |
A method defined by the Func<ITreeViewNodeInfo, bool> signature.
|
The CustomFilter property allows you to replace the default filter behavior.
The following code maps month names ( June , July , and August ) with the word Summer :
<DxTreeView ShowFilterPanel="true"
CustomFilter="@((n) => IsSummer(n.Text))"
@bind-FilterString=@FilterString
FilterMode="NavigationFilterMode.Nodes"
CssClass="cw-480"
Data="@DataSource"
LoadChildNodesOnDemand="true"
@ref=@treeView>
<DataMappings>
<DxTreeViewDataMapping HasChildren="HasSubGroups"
Children="SubGroups"
Text="Title" />
</DataMappings>
</DxTreeView>
@code {
string FilterString = "";
bool IsSummer(string Text) {
if (FilterString == "Summer" && (Text.Contains("June") || Text.Contains("July") || Text.Contains("August")))
return true;
else
return false;
}
DxTreeView treeView;
@* ... *@
}
Note that you should also implement custom highlight logic if required. Use the NodeTextTemplate property to do so. Refer to our GitHub example for implementation details.
View Example: Implement Custom Filter
See Also