blazor-devexpress-dot-blazor-dot-treeviewnodeeventargs-055a9c6d.md
Returns the reason why the TreeView node’s state changes.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
public NavigationItemStateChangeReason Reason { get; }
| 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.
|
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