DxTreeViewBase.BeforeCollapse Event

Fires when a node is about to be collapsed and allows you to cancel the action.

Namespace: DevExpress.Blazor.Base

Assembly: DevExpress.Blazor.dll

Declaration

[Parameter]
public Action<TreeViewNodeCancelEventArgs> BeforeCollapse { get; set; }

Parameters

Type Description
TreeViewNodeCancelEventArgs

Remarks

The code sample below demonstrates how to prohibit root-level nodes from collapsing.

<DxTreeView BeforeCollapse="@BeforeCollapse">
    ...
</DxTreeView>

@code  {
    void BeforeCollapse(TreeViewNodeCancelEventArgs e) {
        if (e.NodeInfo.Level == 0) e.Cancel = true; 
    }
}
See Also