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

How to drag and drop the merged Cells in WinForms GridControl?

Platform: WinForms |
Control: GridControl

Dragging and dropping for merged cells

By Default, GridControl Drag and Drop operation is done for merged cells. But merge cell cannot be moved as merged cell. For more information, please refer the below image,

Drag the merged cells in grid



In order to achieve drag and drop of merged cells, QueryCanOleDragRange event can be used and merged cell will be considered as individual cells by adding the drag and drop range to selection. So that merge cells also can be dragged to another place as merge cells.



//QueryCanOleDragRange event.
void gridControl1_QueryCanOleDragRange(object sender, GridQueryCanOleDragRangeEventArgs e)
      if (e.Range.Left != e.Range.Right || e.Range.Top!=e.Range.Bottom)



‘QueryCanOleDragRange event.
Private Sub gridControl1_QueryCanOleDragRange(ByVal sender As Object, ByVal e As GridQueryCanOleDragRangeEventArgs)
    If e.Range.Left <> e.Range.Right OrElse e.Range.Top<>e.Range.Bottom Then
    End If
End Sub




Drag and drop the merged cells in grid



C#: DragDrop_MergedCells_CS

VB: DragDrop_MergedCells-VB 


Reference link: https://help.syncfusion.com/windowsforms/grid-control/drag-and-drop#blocking-the-data-before-dragging

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon 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.Close Icon

Live Chat Icon For mobile