Articles in this section
Category / Section

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

1 min read

Dragging and dropping for merged cells

By Default, WinForms Grid Control 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

 

Solution

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.

 

C#

//QueryCanOleDragRange event.
void gridControl1_QueryCanOleDragRange(object sender, GridQueryCanOleDragRangeEventArgs e)
{
      if (e.Range.Left != e.Range.Right || e.Range.Top!=e.Range.Bottom)
      this.gridControl1.Selections.Add(e.Range);
}

 

VB

‘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
        Me.gridControl1.Selections.Add(e.Range)
    End If
End Sub
 

 

Screenshot

 

Drag and drop the merged cells in grid

 

Samples:

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

 

Conclusion

I hope you enjoyed learning about how to drag and drop the merged Cells in WinForms GridControl.

You can refer to our WinForms Grid Control’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms Grid Control documentation to understand how to present and manipulate data.

For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms Grid Control and other WinForms components.

If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied