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

How to Drag and Drop between 2 TreeListView

7 Answers 155 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Jorge Alberto
Top achievements
Rank 1
Jorge Alberto asked on 26 Jul 2011, 06:05 AM
Hello everybody :)

I would like to know how to implement the drag and drop functionality between two TreeListViews.
I really appreciate it, if you can send me a working WPF project sample with this functionality.

Thanks, in advance, for your time.
Best regards.
Jorge

7 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 28 Jul 2011, 04:33 PM
Hello Jorge Alberto,

I have just posted an answer to the other thread you have opened (the one about drag and drop between RadGridViews) There approach here is quite similar. Please, let me know whether you have managed to implement it successfully and do not hesitate to inform us of any further questions on this topic.

Regards,
Ivan Ivanov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Jorge Alberto
Top achievements
Rank 1
answered on 30 Jul 2011, 05:18 AM
Hello Ivan

I have attached this four handlers to my TreeViewList: 

TreeViewList1.AddHandler(RadDragAndDropManager.DragQueryEvent,
            new EventHandler<DragDropQueryEventArgs>(TreeViewList1_OnDragQuery));

TreeViewList1.AddHandler(RadDragAndDropManager.DropQueryEvent,
      new EventHandler<DragDropQueryEventArgs>(TreeViewList1_OnDropQuery));

 TreeViewList1.AddHandler(RadDragAndDropManager.DragInfoEvent,
           new EventHandler<DragDropEventArgs>(TreeViewList1_OnDragInfo));
        
TreeViewList1.AddHandler(RadDragAndDropManager.DropInfoEvent, 
           new EventHandler<DragDropEventArgs>(TreeViewList1_OnDropInfo)); 

The TreeViewList1_OnDragQuery and the TreeViewList1_OnDragQuery event handlers are not executing when I debug the proyect. 
Is this the correct behavior on the TreeViewList?

I really appreciate it if you send me a working wpf sample proyect implementing the drag and drop between two TreeViewLists to have a base source code where I can begin.

Best regards
Jorge Alberto
0
Jorge Alberto
Top achievements
Rank 1
answered on 30 Jul 2011, 05:46 AM
Hello Ivan

I really appreciate it if you could send me a working wpf sample proyect implementing the drag and drop between two TreeViewLists: tree1 and tree2 with the following behavior:
1. Moving one item from the tree1 to the tree2, the target position could be before, after or inside.
2. Moving one item from the tree2 to the tree1, the target position could be before, after or inside.
3. Moving one item from the tree1 to another position(before, after or inside) on the tree1
4. Moving one item from the tree2 to another position(before, after or inside) on the tree2

I hope you can help me.
Thanks in advance

Jorge Alberto
0
Ivan Ivanov
Telerik team
answered on 02 Aug 2011, 10:27 AM
Hi Jorge Alberto,

I have prepared a working sample project that implements drag and drop from one TreeListView to another one. The example respects drop position as you have requested (before, inside, after). I think that it will serve you as a good starting point when implementing the other features. Please, do not hesitate to contact us if any further inquiries occur.

Regards,
Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
0
Jorge Alberto
Top achievements
Rank 1
answered on 03 Aug 2011, 12:14 AM
Thank you very much, Ivan!
0
Attila
Top achievements
Rank 1
answered on 08 Jan 2014, 12:58 PM
Hello Ivan,

I have tried your samble project which implements drag and drop from one TreeListView to another one, but there seems to be several problems:
1. Let's say I have the following structures:
    -> A1                                      ->A2
    -> B1    ->B2 
   I  want to drop B1 inside B2, but I can only drop it before or after. This problem appears only for the last element of the tree

2. For the following structure:
   ->A1                                       ->A2
   ->B1          ->A21
 ->A22
                                                  ->B2
I want to drop B1 just before B2. I will get an exception: "Index must be within the bounds of the List."   
This exception is thrown only when the tree is expanded.

Are you aware of these problems? Have you found a solution?
I would really appreciate your help.
Thank you
0
Manuel
Top achievements
Rank 1
answered on 03 Apr 2014, 04:06 PM
hi, I hope I can help with an example with TreeListView to do drag and drop between two different nodes trelistviews. with the version of telerik q1 2014. thanks
Tags
TreeListView
Asked by
Jorge Alberto
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Jorge Alberto
Top achievements
Rank 1
Attila
Top achievements
Rank 1
Manuel
Top achievements
Rank 1
Share this question
or