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
close icon

DragDrop GridData

I am trying to allow the user to drag multiple cells off the grid and display the results in another control. I have been able to get the GridData object from the DragEventArgs variable. gd = (Syncfusion.Windows.Forms.Grid.GridData)e.Data.GetData(typeof(Syncfusion.Windows.Forms.Grid.GridData)); But I'm not sure how to get the cell contents from the GridData object itself. The following always returns false. gd.Contains(1, 1); What I really want is the original position of the dragged cells (e.g. "B2", "C3", etc). Is there any sample code out there that shows how to do this?

3 Replies

AD Administrator Syncfusion Team August 13, 2003 10:27 PM UTC

Attached is a sample that drags a GridData object to a TextBox. There is no cell information included in the GridData object, so if you want that information, you can add another dataobject to the ole dataobject that is part of the drag. The sample does this by adding a point object that contains the top-left cell indexes of the source data.


AD Administrator Syncfusion Team August 13, 2003 11:48 PM UTC

Wow, thanks! Looks like I was missing this step: GridStyleInfo style = new GridStyleInfo(data[row, col]); Just to confirm, the GridData object does not return multiple selection ranges, correct? (RowCount or ColCount will only be greater than 1 if an entire row/column is selected.) If I need to support multiple cell selections I should just create my own list object in QueryOleDataSourceData, right?


AD Administrator Syncfusion Team August 14, 2003 05:18 AM UTC

The default implementation only drags the active range. You could handle mulitple ranges by handling the QueryOleDataSourceData and placing a GridRangeInfoList in the ole dataobject (like the sample did with a Point object). Your drop target would have to handle the GridRangeInfoList data.

Loader.
Live Chat Icon For mobile
Up arrow icon