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.
Unfortunately, activation email could not send to your email. Please try again.


Thread ID:





37906 Dec 1,2005 04:58 PM Dec 5,2005 11:32 AM Windows Forms 4
Tags: GridControl
Administrator [Syncfusion]
Asked On December 1, 2005 04:58 PM

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.

Administrator [Syncfusion]
Replied On December 1, 2005 09:44 PM

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

Administrator [Syncfusion]
Replied On December 2, 2005 02:14 PM

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

Administrator [Syncfusion]
Replied On December 4, 2005 07:53 PM

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.

Administrator [Syncfusion]
Replied On December 5, 2005 11:32 AM

Thank you this work perfectly!


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.