Drag drow between 2 treeviews

4 posts, 0 answers
  1. Kennet
    Kennet avatar
    104 posts
    Member since:
    Jun 2009

    Posted 17 Sep 2010 Link to this post


    I have two treeviews, the "A" is an inventory of stuff, and "B" is a "shopping list". In "A" I don't want any changes and no drop is allowed.

    Problems:

    1. On "A"  treeview I don't want any drop at all so I have IsDropAllowed=False on each RadTreeViewItem, but still I can drop between two items, I don't want that, what to do?

    2. When I drag from "A" to "B" the item removes on "A" treeview, I don't want items removed on my "stuff list". 

    3. When drop on "B" treeview I can drop between RadTreeViewItems, I only want to drop on specific Items. How to solv that?

    My code is based on Telerik "DragDrop.Example", so no drag-drop code in C#, only WPF. But code is OK for this solution.

    Thanks!
  2. Kennet
    Kennet avatar
    104 posts
    Member since:
    Jun 2009

    Posted 18 Sep 2010 Link to this post

    OK, so I have solved most issues with "RadDragAndDropManager.DropQueryEvent" (point 1 & 3)

    But I still have one question: How do I stop that items from being removed when I drag from one treeview to another treeview? Se one of my treeviews as a list of "stuff" that sould always be there. In the other treeview I want regular dragdrop.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Kennet
    Kennet avatar
    104 posts
    Member since:
    Jun 2009

    Posted 19 Sep 2010 Link to this post

    Ok, all problems solved. I used HierarchicalDataTemplate, DragQueryEvent and finaly e.Handled = true in PreviewDragEnded.

    Case Closed ;.)
  5. Daniel Munnings
    Daniel Munnings avatar
    1 posts
    Member since:
    Dec 2009

    Posted 19 Sep 2010 Link to this post

    Hi Kennet,

    Can you please post your code as I need to implement the same logic in one of our app.

    You help greatly appreciated.

    Thanks
    Daniel
Back to Top