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

Drag drow between 2 treeviews

3 Answers 36 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kennet
Top achievements
Rank 2
Kennet asked on 17 Sep 2010, 03:43 PM

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!

3 Answers, 1 is accepted

Sort by
0
Kennet
Top achievements
Rank 2
answered on 18 Sep 2010, 11:21 AM
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.
0
Kennet
Top achievements
Rank 2
answered on 19 Sep 2010, 02:05 PM
Ok, all problems solved. I used HierarchicalDataTemplate, DragQueryEvent and finaly e.Handled = true in PreviewDragEnded.

Case Closed ;.)
0
Daniel Munnings
Top achievements
Rank 1
answered on 20 Sep 2010, 03:27 AM
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
Tags
TreeView
Asked by
Kennet
Top achievements
Rank 2
Answers by
Kennet
Top achievements
Rank 2
Daniel Munnings
Top achievements
Rank 1
Share this question
or