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

RadTreeView and DragDropManager

4 Answers 163 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Dušan
Top achievements
Rank 1
Dušan asked on 20 Feb 2013, 09:04 AM
Greetings,

I would like to ask you for help. I am using RadTreeView with IsDragDropEnabled=True. But now I realised that I need to drag & drop data from RadGridView to RadTreeView but this data should not be added to the tree. On the drop they should be only added to the some initernal collection of mine.
I am able to start Drag operation from RadGridView with some visual effect. Problem is that Drop handler is never called if I drop on the RadTreeView. It is only called if I register that handler with true like this:
DragDropManager.AddDropHandler(radTreeView1, OnDrop, true);

RadTreeView has set IsDragDropEnabled=true and each RadTreeViewItem has drag and drop allowed like this:
<Setter Property="AllowDrop" Value="true" />
<Setter Property="telerik:DragDropManager.AllowDrag" Value="True" />

In you examples I have seen that it should not be a problem to add handler for drop without "true" flag like this:
 DragDropManager.AddDropHandler(radTreeView1, OnDrop); 
but it does not work for me.

I really do not know what control is handeling drop operation.
Is there something else what I should do so I can call AddDropHandler without setting last parameter "true"?

Thanks for your advise.
Dusan Hudecek

4 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 22 Feb 2013, 02:27 PM
Hi Dusan,

If you want to implement drag and drop operations from RadGridView to RadTreeView control you can refer to this online demonstration project. Please note that the internal logic for drag and drop of the RadTreeView control is disabled (IsDragDropEnabled = False) and behaviors are used instead. Also, please note that during this Q we will refactor the RadTreeView and will integrate the new DragDropManager.

Can you please elaborate on your scenario why is it an obstacle to set the third argument (true) in the AddHandler() method? You have to set it in order to be able to handle the drop operation. This is required because the RadTreeView control internally handles the event.

Hope this helps.

Kind regards,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Dušan
Top achievements
Rank 1
answered on 27 Feb 2013, 07:50 AM
Greetings,

thank you for you answer. Actually I am using methods of DragDropManger which add Handlers with third parameter set to "true". Everything is working without problem. The reason I asked the question is that I thought if I set IsDragDropEnabled to "false" on RadTreeView that I will be able to use that methods without third parameter.
Even in you example you are not using the third parameter as you can see in TreeViewDragDropBehavior.cs in you example. So RadTreeView is not handling drag drop operation internally is it?

Thanks for your reply.
Dusan Hudecek
0
Tina Stancheva
Telerik team
answered on 01 Mar 2013, 06:11 PM
Hi Dusan,

The RadTreeView is currently using the old RadDragAndDropManager to handle its built-in drag/drop logic. This means that the DragDropManager events are also internally handled by the control. This logic can be triggered by setting the IsDragDropEnabled property to True. However, as the RadDragAndDropManager is obsoleted, we will change the RadTreeView implementation to use the DragDropManager internally instead.

But in the meantime we advice our customers to implement any between-controls drag/drop scenarios using the DragDropManager only. And in order to avoid any crashes between the custom and built-in drag/drop logic of the RadTreeView, it is best to leave the IsDragDropEnabled property unset (as by default it is set to False). This is the approach used in our examples - and as the internal drag/drop RadTreeView logic is disabled, the DragDropManager events aren't internally handled and you don't need the third attribute of the AddHandler methods.

I hope this information clears things up a bit. Still, please let us know if we can further assist you.

Kind regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Dušan
Top achievements
Rank 1
answered on 04 Mar 2013, 09:41 AM
Hi,

now it is clearer.
Thanks for your help.

Dusan Hudecek
Tags
TreeView
Asked by
Dušan
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Dušan
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or