Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TreeViewNodeEventArgs.Reason Property

Returns the reason why the TreeView node’s state changes.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public NavigationItemStateChangeReason Reason { get; }

#Property Value

Type Description
NavigationItemStateChangeReason

A NavigationItemStateChangeReason enumeration value.

Available values:

Name Description
ApiCall

The state changes programmatically.

UserAction

The state changes by user action.

UrlMatch

The state changes as a result of URL matching.

#Remarks

The following example collapses all items if a user tries to expand a node:

Razor
<DxTreeView @ref="@treeView" BeforeExpand="@BeforeExpand" ...> 
    ... 
</DxTreeView> 

@code { 
    DxTreeView treeView; 
    protected void BeforeExpand(TreeViewNodeCancelEventArgs e) { 
        if (!e.Reason.ToString() == NavigationItemStateChangeReason.UserAction) 
            treeView.CollapseAll(); 
    } 
} 
See Also