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

Copy from one tree to another but move when dragged in own tree

2 Answers 38 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Anders
Top achievements
Rank 2
Anders asked on 03 May 2011, 09:44 AM
Hi, I got two treeview'sv called T1 and T2 from now, and I need them to behave like illustrated in this image.

Copy N Move

  1. If the dragged item is being dragged in the same treeview just move it.
  2. If the dragged item is being dragged from T1 to T2 Copy it.
  3. It the dragged item is being dragged from T2 to T2 disallow it.

2 Answers, 1 is accepted

Sort by
0
Accepted
Tina Stancheva
Telerik team
answered on 06 May 2011, 10:29 AM
Hi Anders,

In order to implement this scenario you will need to handle the first TreeView control's PreviewDragEnded() event in case when the TargetDropItem is in the second TreeView control. This will implement the copy drag from tree1 to tree2.

In order to deny drag/drop operations from tree2 to tree1, you need to handle the OnDropQuery() event for the first TreeView. Then if the dragged item comes from the second tree, you will need to return a QueryResult false, which will indicate that the drop operation is invalid and will not allow it to happen.

I attached a sample project to get you started. I hope it helps.

Best wishes,
Tina Stancheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Anders
Top achievements
Rank 2
answered on 10 May 2011, 09:03 AM
Works just like i needed it to.

Thanks for a great support :-D
Tags
TreeView
Asked by
Anders
Top achievements
Rank 2
Answers by
Tina Stancheva
Telerik team
Anders
Top achievements
Rank 2
Share this question
or