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

DxTreeView.SelectionChanged Event

Fires after node selection has been changed.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v20.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public Action<TreeViewNodeEventArgs> SelectionChanged { get; set; }

Event Data

The SelectionChanged event's data class is TreeViewNodeEventArgs. The following properties provide information specific to this event:

Property Description
CausedByAPI Specifies whether an event was triggered by a user action or programmatically.
NodeInfo Returns information about a node related to the event.

Remarks

Write a SelectionChanged event handler to perform specified actions each time a node selection is changed by end-user interaction.

<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