RadTreeView and DragDropManager

5 posts, 0 answers
  1. Dušan
    Dušan avatar
    8 posts
    Member since:
    Oct 2012

    Posted 20 Feb 2013 Link to this post

    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
  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1183 posts

    Posted 22 Feb 2013 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Dušan
    Dušan avatar
    8 posts
    Member since:
    Oct 2012

    Posted 27 Feb 2013 Link to this post

    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
  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 01 Mar 2013 Link to this post

    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.

  6. Dušan
    Dušan avatar
    8 posts
    Member since:
    Oct 2012

    Posted 04 Mar 2013 Link to this post

    Hi,

    now it is clearer.
    Thanks for your help.

    Dusan Hudecek
Back to Top
UI for WPF is Visual Studio 2017 Ready