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

GGC D&D

Hi, I''m probably asking a question which have been asked before. Is there a comprehensive example on how to implement a D&D in GGC? The following example seems like a good starting point: http://www.syncfusion.com/Support/user/uploads/GGC_DnD_2345b585.zip But as soon as I change ListBoxSelectionMode=One, it stops working. Ultimately I would like to implement the following functionality: 1. Two GGC 2. I drag a row from one to another. Only Parent rows are draggable. 3. While dragging some AlfaBlend image of the row(or alike) is dragged with the cursor. (Similar to the Columns dragging) 4. While dragging over destination grid the destination rows are highlighted. 5. When the drop happens some custom logic is executed (datasource modified) I would greatly appreciate if you could at least point me to the right direction. Thank you in Advance.

4 Replies

AD Administrator Syncfusion Team December 2, 2005 02:44 AM UTC

We have not implemented D&D support for the GridGroupingControl yet, so there is no detailed sample code available currently. Here is that sample modified to handle selecting a row and still being able to drag it. http://www.syncfusion.com/Support/user/uploads/GGC_DnD_bd6cec27.zip As far as doing what you want, in the sample above, try mousing down on a column header and dragging it to the textbox. This is essentially the UI you described except you want it to work for a whole row and not just a simgle cell. To get this behavior, the simplest thing to do is to create your own mouse controller class. You can copy the GridTableControlDragHeaderMouseController class from our source code to your project, rename it and modify it to handle the D&D behavior that you want. This is will take some coding but it is doable. We ship several samples showing how to register a custom mouse controllers including \Grid.Windows\Samples\In Depth\CellCommentTips\CS\ExcelTipDll\CommentMouseController.cs and \Grid.Windows\Samples\In Depth\ExcelSelectionMarker\CS\ExcelMarkerMouseController.cs


AD Administrator Syncfusion Team December 2, 2005 07:14 PM UTC

Thank you for the comprehensive answer! Still there are few things I would like to clarify. 1. How do I determine in IMouseController events MouseHover, etc. if data is being dragged, but not simple mouse hover? 2. How do I access the dragged data? I''ve tried to subscribe to DragDrop, DragOver, etc events in the constructor of the IMouseController implementation, but they don''t seem to fire within the implementation. I managed to get something working by just subscribing to drag events and handling them within the Form. Is it possible in this scenario to do row highlighting ( Border color ) in DragOver? That’s what I’m currently doing: private void grid_DragOver(object sender, DragEventArgs e) { GridGroupingControl grid = (GridGroupingControl)sender ; Point p=new Point(e.X, e.Y); Point c=grid.TableControl.PointToClient(p); // showing the dragdrop effects. if(e.Data.GetDataPresent(typeof(SelectedRecordsCollection))) { e.Effect = DragDropEffects.Copy; int row, col; if(grid.TableControl.PointToRowCol(c, out row, out col, -1)) { GridTableCellStyleInfo style = grid.TableControl.Model[row, col]; Style.BackColor=Color.Red; } } } Thank you again


AD Administrator Syncfusion Team December 5, 2005 12:53 AM UTC

Code like: GridTableCellStyleInfo style = grid.TableControl.Model[row, col]; Style.BackColor=Color.Red; is suspect in a GridGroupingControl. You cannot set cell properties (other than CellValue or Text) in a GridGroupingControl using an indexer. If you want to do something like this, you would need to use the QueryCellStyleInfo event.


AD Administrator Syncfusion Team December 5, 2005 04:32 PM UTC

Thank you this work perfectly!

Loader.
Live Chat Icon For mobile
Up arrow icon