How do I perform a DragDrop operation from a DataGrid to a TreeViewAdv?

Does anyone have an example of dragging from a DataGrid control to a TreeViewAdv control?

I know this may not be a simple answer, but a starting point would be appreciated. I can fill in details as I work on it.

The attachment show a DataGrid on the right and a TreeViewAdv on the left. I want to drag BoxNumber 0000043 from the DataGrid onto the TreeViewAdv so the box moves to another location, like from B02 to B05.

Thanks in advance

DragDrop from DataGrid to TreeViewAdv.zip

2 Replies

HA haneefm Syncfusion Team May 7, 2007 09:19 PM UTC

Hi Greg,

Here is minimal sample with a class added that implements IGridDataObjectConsumer to provide drop support for a treenode. This implemetatin just automaticlly drops the node text as a new row to a Grid.

The steps are
1) add the TreeNodeDataObjectConsumer class whcih implements IGridDataObjectConsumer to support dropping of TreeNode objects.
2) add a Form_Load to register a TreeNodeDataObjectConsumer object as a dataconsumer that the grid will poll as part of its D&D support.

Sample : D&DGridTreeView.zip

Best regards,
Haneef


GG Greg Goodall May 8, 2007 01:04 PM UTC

Haneef,

This works well going from a TreeView to a DatGrid but I'm need to go in the other direction. I need to drag from the DataGrid and drop onto the TreeView. Also, my TreeView will have two levels, 1)a parent and 2) multiple children. I only want to be able to drop onto a child node. When the drop happens I don't need to add a new node, I just need to know which node this being "dropped" on. When I have that information I will perform a query that reloads the DataGrid (I can do the re-load part). I just don't know how to capture which TreeView node is being targetted.

One last piece of info. The user will click on the RowHeader in the DataGrid and drag that. In fact there may be one or more rows clicked/dragged.

Thanks again

Loader.
Up arrow icon