Skip to main content
All docs
V25.1
  • TreeViewNodeEventArgs.Reason Property

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

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.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 collapses 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