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

TreeView to TreeView DragDrop with DataConverter

3 Answers 101 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kyle
Top achievements
Rank 1
Kyle asked on 20 May 2013, 09:08 PM
I have 2 RadTreeView controls, each of the trees has it's own data type. When dragging from TreeView1 to TreeView2, I would like to do a data conversion from type 1 to type 2. Is there an example of using the DataConverter of the DragDropManager to accomplish this? Or can someone point me in the right direction?

3 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 23 May 2013, 07:25 AM
Hi Kyle,

The DataConverter of the DragDropManager can be used along with behaviors. However, we do not support behaviors for the RadTreeView control yet. This is why you can use the built-in drag&drop logic and modify only the Drop and DragDropCompleted events. The Drop event is fired when you drop an item. In the handler you can turn off the default drag&drop logic by setting the drop action to None (the default value is Move). This can be done with the following code:

var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;
            if (options != null)
            {
                options.DropAction = DropAction.None;
            }
Furthermore, the DragDropCompleted event is fired after the Drop. This is why you can implement your custom conversion and drop logic in its handler. Please note that you have to check where the user dropped the item and perform actions accordingly.

For your convenience we implemented this approach in the attached project. Please take a look at it and let us know if it works for you.

Regards,
Pavel R. Pavlov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Kyle
Top achievements
Rank 1
answered on 11 Jun 2013, 08:31 PM
Pavel -
Thank you for the example. It was a great help. Is there a timeline for when behaviors will be added to RadTreeView?
Kyle
0
Pavel R. Pavlov
Telerik team
answered on 14 Jun 2013, 11:10 AM
Hello Kyle,

We plan to spend resources on researching whether it is possible to integrate all available drag and drop behaviors into one. With such behavior we can allow our customers to implement, in an even easier way, drag and drop operations between all our controls.

However, at the time of writing we can not estimate a time-frame for the release of such behavior.

Regards,
Pavel R. Pavlov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TreeView
Asked by
Kyle
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Kyle
Top achievements
Rank 1
Share this question
or