Skip to main content

TreeViewNodeEventArgs.Reason Property

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

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

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 shows how to collapse all items if a user tries to expand a node:

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

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