Back to Devexpress

DxTreeView.SelectionChanged Event

blazor-devexpress-dot-blazor-dot-dxtreeview-e466a436.md

latest1.9 KB
Original Source

DxTreeView.SelectionChanged Event

Fires after node selection has been changed.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

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

Event Data

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

PropertyDescription
CausedByAPIObsolete. Specifies whether an event was triggered by a user action or programmatically.
NodeInfoReturns information about a node related to the event.
ReasonReturns the reason why the TreeView node’s state changes.

Remarks

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

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

@code {
    string SelectedGroup = "none";

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

Run Demo: TreeView - Selection

See Also

DxTreeView Class

DxTreeView Members

DevExpress.Blazor Namespace