How to Drag and Drop between 2 TreeListView

8 posts, 0 answers
  1. Jorge Alberto
    Jorge Alberto avatar
    38 posts
    Member since:
    Dec 2009

    Posted 26 Jul 2011 Link to this post

    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

  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 28 Jul 2011 Link to this post

    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!

  3. UI for WPF is Visual Studio 2017 Ready
  4. Jorge Alberto
    Jorge Alberto avatar
    38 posts
    Member since:
    Dec 2009

    Posted 30 Jul 2011 Link to this post

    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
  5. Jorge Alberto
    Jorge Alberto avatar
    38 posts
    Member since:
    Dec 2009

    Posted 30 Jul 2011 Link to this post

    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
  6. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 02 Aug 2011 Link to this post

    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 >>
  7. Jorge Alberto
    Jorge Alberto avatar
    38 posts
    Member since:
    Dec 2009

    Posted 02 Aug 2011 Link to this post

    Thank you very much, Ivan!
  8. Daniel
    Daniel avatar
    11 posts
    Member since:
    Oct 2011

    Posted 08 Jan 2014 Link to this post

    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
  9. Manuel
    Manuel avatar
    3 posts
    Member since:
    Mar 2014

    Posted 03 Apr 2014 Link to this post

    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
Back to Top
UI for WPF is Visual Studio 2017 Ready