New to Telerik UI for Blazor? Download Free 30-day trial
TreeView - Drag & Drop
- EXAMPLE
- VIEW SOURCE
- EDIT IN TELERIK REPL
- Change Theme
default
- Drag-drop.razor
Description
Telerik UI for Blazor TreeView displays data in a tree-like structure. One of the main functionalities it gives is drag and drop. It allows you to move a node or multiple nodes between different parents in the same Treeview or between different component instances.
To enable the drag and drop functionality, set the Draggable parameter to true. Then, use the DragStart, OnDrag, OnDragEnd, OnDrop events to handle the drag and drop operations and modify the data source as per the application business logic.
The DragStart event fires when the user starts dragging a node. It provides details for the dragged items and allows you to cancel the event.
The OnDrag event fires continuously while the user is dragging a node.
The DragEnd event fires fires when a drag operation is ended by releasing the mouse button.
The OnDrop event fires when dropping a node into a new location. That allows you to manipulate the data collection based on where the user dropped the element.
Note that - the OnDrop event fires for the TreeView where the item originally was if you drag and drop items from one instance of the TreeView to another.