DxTreeView.GetSelectedNodeInfo() Method

Returns information about the selected node.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

public ITreeViewNodeInfo GetSelectedNodeInfo()

Returns

Type Description
ITreeViewNodeInfo

An object that contains information about the selected 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);
        }    
    }
    ...
See Also