Skip to main content

DxTreeView.ExpandToNode(Func<ITreeViewNodeInfo, Boolean>) Method

Expands the nodes down to the specified node.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public void ExpandToNode(
    Func<ITreeViewNodeInfo, bool> predicate
)

Parameters

Name Type Description
predicate Func<ITreeViewNodeInfo, Boolean>

A method delegate that specifies a particular node.

Remarks

The code sample below demonstrates how to expand a selected node if it has children.

<DxTreeView @ref="@SampleTreeView" AllowSelectNodes="true" SelectionChanged="@SelectionChanged">
    @* ... *@
</DxTreeView>

@code  {
    DxTreeView SampleTreeView;

    protected void SelectionChanged(TreeViewNodeEventArgs e) {
        SampleTreeView.CollapseAll();
        SampleTreeView.ExpandToNode((n) => n.Text == e.NodeInfo.Text);

        if (!SampleTreeView.GetSelectedNodeInfo().IsLeaf) {
            SampleTreeView.SetNodeExpanded((n) => n.Text == e.NodeInfo.Text, true);
        }    
    }
}

Note

This method does not expand the specified node if Load Child Nodes on Demand mode is enabled, and the node is not loaded yet.

See Also