We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Drag and Drop with the GridDataBoundGrid

I'm trying to implement drag & drop functionality between the grid and another control (treeview) on my form. I'd like to catch the MouseDown event to detect which row the user clicked (via the x,y coords of the MouseEventArgs) and have select that entire row for the drag operation. I have implemented this before with the standard WinForms datagrid via the HitTestInfo but I'm not sure how to do it with the Syncfusion Grid. Thanks! -Paul

2 Replies

AD Administrator Syncfusion Team July 3, 2003 04:50 PM

Here is some general information and a couple of samples that might get you going. Essential Grid has an extensible OLE D&D architecture that you can tie into if you want. You would not have to handle things like DragEnter, DrawOver, etc. Instead, you create your own dataobject that implements IGridDataObjectConsumer, and register this object with RegisterDataObjectConsumer that tells the grid to check for your dataobject in its OLE D&D. Attached is a VB project that shows how you can create a dataobject to drag a row for a Windows Forms DataGrid to a GridControl. There are only 4 items you need to implement for the interface as you can see from the sample. Here is another sample with a class added that implements IGridDataObjectConsumer to provide drop support for a treenode. This implemetation justs automaticlly drops the node text as a new row to a GriddataBoundGrid (not quite what you want). 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. If you get stuck, post again.


PL Paul Laudeman July 8, 2003 05:01 AM

Thanks for your quick response. As it turns out, all I was missing was my event handler in code. Apparently VS.NET dropped the "handles" statement from my event handler when I deleted the winforms datagrid and replaced it with the Syncfusion grid.

Loader.
Live Chat Icon For mobile
Up arrow icon