It is not possible to drop item to empty treevew
|Product||TreeView for Blazor|
It seems it is not possible to drop item to empty treevew.
How can I drop items into a treeview that is empty?
- Go to the TreeView Drag and Drop demo: https://demos.telerik.com/blazor-ui/treeview/drag-drop
- Remove all the nodes from the second treeview (the drop target), for example, by dragging them to the first treeview.
- Try to drag a node to the now empty treeview.
When there is no data in the treeview, you can't drop items into it because it does not render anything and so there is no drop target.
Ensure you always have at least one dummy node with text like "(empty)" or "(drag here)" so there is a drop target.
When processing the data in the
OnDrop event, consider checking if this is the target (only) item and if so - removing it from the data source you will build, so that newly added data will have its proper structure and that placeholder item will now be gone.