Nov 5, 2009 at 9:05 AM

I need to add drag-and-drop functionality to my grid where the user can drag the data of the currently selected rows from the grid to an other component in the same form (to one of the elements in a  ListView). I am using SourceGrid 4.21 where there seems to be Drag-and-Drop features implemented in the classes SourceGrid.Controllers.SelectionDrag and SourceGrid.Controllers.SelectionDrop, however these classes does not seem to be part of the prebuild  assembly since I cannot compile against them. Are these classes working and if so what's the best way to get them working as intended in my project ? Also are there any code samples using drag-and-drop?

Best Regards,






Nov 6, 2009 at 7:08 AM

Hi Johan,

You are absolutely right. For some reason they are not included into the project. I am not the original creator of this project, so the reason for doing this is not know to me.

I have heard that drag-drop support was dropped in SourceGrid 3, and never included again.

it would be most welcome If you could add these classes to source grid and check that they work ok. A working windows form sample to test this functionality would be appreciated alot too ;)

Nov 9, 2010 at 10:23 AM
Edited Nov 9, 2010 at 10:25 AM

1) Seems to me if you want to drag and drop from treeview or listview onto the grid, you just grid.AllowDrop = true ,   set your grid.DragEnter, .DragDrop events to a proper handler   and in DragEnter  event make sure to e.Effect = e.AllowedEffect   to enable the operation if the data  is kosher.


2) when you want to drag from the grid to something like a listview as you're talking about it doesn't make sense in my mind to have this hard coded into the sourcegrid control.  A good example, if your grid is being used in some plugin dll created by a user and loaded by your host application, then your host application wont necessarily know anything about the custom types employed by the SourceGrid used by the user's custom plugin.  Thus the drag and drop data should be formatted to the listview or treeview in a way that is specified by the host application and which the plugin developer must follow.

That is one clear example of why its good these drag/drop handlers within the control are now dead.

You should be handling the DoDrag  operation yourself and wrapping the data in a format that your treeview or Listview OnDragDrop event will know how to handle.

Aug 17, 2011 at 8:15 PM

i've just started using the control today, but can't find a way to get the cell you drop an item on.... maybe that's the why the controls where needed... as for why they're not here anymore... that's a mystery....