DxTreeViewBase.AllowSelectNodes Property

Specifies whether or not nodes can be selected.

Namespace: DevExpress.Blazor.Base

Assembly: DevExpress.Blazor.dll

Declaration

[Parameter]
public bool AllowSelectNodes { get; set; }

Property Value

Type Description
Boolean

true, to allow selecting nodes, otherwise, false

Remarks

When the AllowSelectNodes property is set to true, the DxTreeView component allows users to select a node with a mouse click. When a node is selected by end-user interaction, the SelectionChanged event fires.

You can use the SelectNode(Func<ITreeViewNodeInfo, Boolean>) method to select a node programmatically.

The code sample below demonstrates how to get a text of the selected node.

<DxTreeView AllowSelectNodes="true" 
    SelectionChanged="@SelectionChanged">
      ...
</DxTreeView>

@code  {
    string SelectedGroup = "none";

    void SelectionChanged(TreeViewNodeEventArgs e)
    {
        SelectedGroup = e.NodeInfo.Text;
        InvokeAsync(StateHasChanged);
    }
}      

The image below shows the result.

TreeView Node Selection

Online Demo

TreeView - Selection

See Also