Hi david,
The drag&drop uses routed events so if you set the IsDropAllowed to each item, so you will be able to handle the DropQuery event for each TreeViewItem by adding a handler at the TreeView. The routed events will travel from each item that your mouse is over, so first an event will travel from the most-nested treeViewitem down the other treeViewItems through the TreeView down to the application root.
You can handle the event at any point. If the event remains unhandled, the DragDrop will look for another element under the mouse that can accept a drop, e.g. the parent TreeViewItem of the aforementioned item.
If you would like to "choose" the item as the destination, make sure that the QueryResult of the EventArgs is set to true and that the event is handled (i.e. no other handler will have a say).
Then, when you handle the DropInfo event there you will have both the
e.Options.Source &
e.Options.Destination you have agreed to earlier (i.e. there is no need to add variables holding the item for the specific picture).
treeViewA.AddHandler(RadDragAndDropManager.DragQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnOrganisationTreeDragQuery), false); |
I have attached an example for dragging items between TreeViews with some logic.
Regards,
Miroslav
the Telerik team
Check out
Telerik Trainer, the state of the art learning tool for Telerik products.