This is a migrated thread and some comments may be shown as answers.

Drag Drop With Confirmation Request

1 Answer 103 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
pierre-jean
Top achievements
Rank 1
Veteran
Iron
pierre-jean asked on 18 Nov 2020, 10:01 AM

Hello

In a treeview drag drop operation I need to get a users validation before proceeding with the actual drop operation.

In the example DragDropTreeViewsVBNET provided in a previous post
I have added a messagebox at the beginning of the drop operation in order to decide if I proceed or not
However this "hangs" the application. I suspect that the drop operation operates in a different thread that
prevents me from opening a messagebox.
I have tried to find a way to achieve this but have failed.
Have you a suggestion ? (I understand this is not a Telerik issue but I would appreciate any suggestion)

Thanks in advance

Pierre-Jean

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Nov 2020, 10:53 AM

Hello, Pierre-Jean,    

I would like to note that RadTreeView handles the whole drag and drop operation by its TreeViewDragDropService. There is an appropriate public API that handles all aspects of the drag and drop operation. The PreviewDragOver event allows you to control on what targets the node element being dragged can be dropped on. The PreviewDragDrop event allows you to get a handle on all the aspects of the drag and drop operation, the source (drag) tree view, the destination (target) control, as well as the node being dragged. This is where we will initiate the actual physical move of the node(s) from one tree view to the target control. 

You can customize the drag and drop service and in the OnPreviewDragDrop method show the confirmation message and then decide what drop logic to be executed according to the user's choice. Please give it a try and see how it works on your end. A sample approach for customizing the TreeViewDragDropService is available in the following help article. You can use it as a starting point: https://docs.telerik.com/devtools/winforms/controls/treeview/drag-and-drop/drag-and-drop-in-bound-mode 

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Treeview
Asked by
pierre-jean
Top achievements
Rank 1
Veteran
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or