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

Unable to Drop within a tree, but can drop from grid to tree

3 Answers 62 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
GEB
Top achievements
Rank 1
GEB asked on 03 Nov 2009, 02:43 PM
I have a DataGrid and a RadTreeView.  I am not using the inherent DnD capabilities within the RadTreeView, but instead using the DragAndDrop manager.  I can successfully DnD from the DataGrid to the tree.  I can also successfully drag a child node from the tree, but I am not able to drop that child node anywhere else on the same tree.  Specifically, I never see the DropPossible event generated where the source is a RadTreeViewItem, but I do see the DropPossible event generated if the source is from the DataGrid.  I do see the DragQuery event and the DropQuery event for the tree.

I checked out the numerous examples available through the forum, but none seem to show the inherent DnD for a RadTreeView turned off, but DragAllowed=true from within the RadTreeView.  Any suggestions?

3 Answers, 1 is accepted

Sort by
0
Bobi
Telerik team
answered on 06 Nov 2009, 02:13 PM
Hi GEB,

I modified one of the examples that demonstrate the usage of Drag and Drop and List Box to work with RadTreeView.
 Please find attached a sample project that shows how to Drag/Drop within a treeview without the usage of the build in drag and drop functionality. The examples demonstrates the basics if you want to use it in more composite scenario the you have to add some additional logic.

Kind regards,
Boryana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Tihomir Petkov
Telerik team
answered on 06 Nov 2009, 02:54 PM
Hi Gary,

Did you check this example:
http://demos.telerik.com/silverlight/#DragAndDrop/TreeToGrid

I believe it's demonstrating exactly your scenario. What you probably didn't know is that the TreeView internally uses our DragAndDrop framework. So, for the "internal" treeview drag and drop the tree is simply handling all drag and drop events. In case you need to listen for these events in your application, you need to  enable the treeview's drag and drop, use the Telerik.Windows namespace, and attach to the event of interest like so:

treeView.AddHandler(RadDragAndDropManager.DropQueryEvent, OnDropQuery, true);

The last parameter in the above method specifies that your handler method will be called even for handled events. It may also be useful to know that the RadTreeViewItems have a IsDropPossible() method that when given a list of dragged items will do some sanity checks and return true or false. You
can also modify an item's DropPosition property which can be set to "before", "in" or "after".

Greetings,
Tihomir Petkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
GEB
Top achievements
Rank 1
answered on 08 Nov 2009, 02:31 AM
I have been able to reproduce the problem in a small sample project, and have submitted it via a Support Ticket.
Tags
TreeView
Asked by
GEB
Top achievements
Rank 1
Answers by
Bobi
Telerik team
Tihomir Petkov
Telerik team
GEB
Top achievements
Rank 1
Share this question
or