Node drag and drop between RadTreeView and RadGridView
Product Version | Product | Author | Last modified |
---|---|---|---|
Q2 2012 | RadTreeView for WinForms | Svetlin Ralchev | May 11, 2012 |
PROBLEM
RadTreeView allows drag and drop between two different instances of RadTreeView out of the box. However, it does not support out of the box drag and drop of a node to a data cell in RadGridView and this is what we will look at in this article.
SOLUTION
In order to implement this feature, we need to handle the PreviewDragOver and PreviewDragDrop events of the TreeViewDragDropService. The steps below demonstrates how you can achieve the desired scenario:
- You should set the AllowDragDrop property of RadTreeView to true.
- Then you should subscribe to the CellFormatting event of RadGridView where you can allow a drop operation over a data cell:
3.Then you should handle the PreviewDragOver event of the TreeViewDragDropService in the following way:
- Finally, you should subscribe for the PreviewDragDrop event of the TreeViewDragDropService:
You can download a complete VB and C# project from the following link.