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
public NavigationItemStateChangeReason Reason { get; }
#Property Value
Type | Description |
---|---|
Navigation |
A Navigation |
Available values:
Name | Description |
---|---|
Api |
The state changes programmatically. |
User |
The state changes by user action. |
Url |
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();
}
}