Skip to main content
All docs
V25.1
  • DxTreeView.CustomFilter Property

    Allows you to implement custom filter logic.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

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

    Property Value

    Type Description
    Func<ITreeViewNodeInfo, Boolean>

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

    Remarks

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

    Custom Filter

    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