blazor-devexpress-dot-blazor-dot-dxtreeview-4334f281.md
Returns information about the selected node.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
public ITreeViewNodeInfo GetSelectedNodeInfo()
| Type | Description |
|---|---|
| ITreeViewNodeInfo |
An object that contains information about the selected node.
|
The following code snippet expands 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