KB Article A1418
Visible to All Users

How to implement drag-and-drop for grid rows

Description:
I'm trying to drag&drop rows from one grid to another. I'm using the MouseDown event to launch drag&drop. This works, but I can no longer group, sort, etc. How to work around this problem?

Answer:
You should use the CalcHitInfo method to determine which of the grid's element the mouse cursor is currently positioned over. In your case, the DoDragDrop method must be called only if a row is clicked. Please review the GridDragDropExternal tutorial project shipped with the XtraGrid. Please note that the DoDragDrop method is called from a MouseMove event handler, and not from the MouseDown event.
See also:
Drag-and-drop data rows from one grid to another
Drag-and-drop of multiple selected grid rows
Drag-and-drop data rows from one grid to another
Drag-and-drop of multiple selected grid rows
How to reorder grid rows by drag and drop
How to draw a line between rows to indicate a drag-and-drop position

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.