New to Telerik UI for Blazor? Download Free 30-day trial
TreeView - Events
- EDIT IN TELERIK REPL
- Change Theme
Telerik UI for Blazor TreeView exposes various events that let you respond to the user actions.
The TreeView fires
OnItemContextMenu events for the corresponding user action – expand/collapse (either with the mouse, or with the keyboard), click/press enter on/taps (for mobile devices), double click, and right-click nodes. You can handle them to update the actual data source.
OnExpand allows you to implement load on demand if needed
SelectedItemsChanged event fires when the selection is enabled and the user clicks on a new item.
CheckedItemsChanged event fires every time the user uses a checkbox to select a new item.
ExpandedItemsChanged event fires every time the user expands or collapses a TreeView item.
If you set the
ShouldRender field of given event arguments to true, the component will re-render after the event (it will call
StateHasChanged()). That can be useful if you need to change its parameters or state during the event execution and especially if you need to execute
async logic in the event handler.
The current demo showcases handling all TreeView events and logging them in an