Skip to main content
A newer version of this page is available. .

DxTreeView.GetSelectedNodeInfo() Method

Returns information about the selected node.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v20.2.dll

NuGet Package: DevExpress.Blazor

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