New to Telerik UI for Blazor? Download Free 30-day trial

TreeView - Drag & Drop

CONSOLE Clear log
  • Drag-drop.razor
Loading the demo source code...please wait.

Style in ThemeBuilder

  • Custom SASS variables
  • Atomic customizations
  • Sharing projects
Start Theming

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.

This Blazor TreeView Drag & Drop example is part of a unique collection of hundreds of Blazor demos, with which you can see all Telerik UI for Blazor components and their features in action. View the source code of the demos from the library or directly adapt, and edit them and their theme appearance in Telerik REPL for Blazor or ThemeBuilder.

Support & Learning Resources

An error has occurred. This application may no longer respond until reloaded.