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 customize the column name in GroupDropArea of WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl

Column customization

The column name in GroupDropArea can be customized by using PrepareViewStyleInfo and QueryColWidth events of GridGroupDropArea.


void Model_QueryColWidth(object sender, Syncfusion.Windows.Forms.Grid.GridRowColSizeEventArgs e)
   GridGroupDropAreaModel grid = sender as GridGroupDropAreaModel;
   if (grid.Model[2, e.Index].CellValue != null && grid.Model[2, e.Index].CellValue.ToString().Contains("\n"))
      GridStyleInfo style = grid.Model[2, e.Index];
      e.Size = this.SetTextWidth(style.Text, style.GdipFont) + 20;
                e.Handled = true;
//Customize the column name in GropuDropArea.
void GridGroupDropArea_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
   if (e.Style.CellValue.ToString().Contains("\n"))
      e.Style.Text = e.Style.CellValue.ToString().Replace("\n", " ");
//Customize the column name in GroupCaptionCell.
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
   if (e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell)
      //To change the group caption text.
      e.Style.Text = e.Style.Text.Replace("\n", " ");



Private Sub Model_QueryColWidth(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridRowColSizeEventArgs)
   Dim grid As GridGroupDropAreaModel = TryCast(sender, GridGroupDropAreaModel)
   If grid.Model(2, e.Index).CellValue IsNot Nothing AndAlso grid.Model(2, e.Index).CellValue.ToString().Contains(Constants.vbLf) Then
      Dim style As GridStyleInfo = grid.Model(2, e.Index)
      e.Size = Me.SetTextWidth(style.Text, style.GdipFont) + 20
      e.Handled = True
   End If
End Sub
'Customize the column name in GropuDropArea.
Private Sub GridGroupDropArea_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs)
   If e.Style.CellValue.ToString().Contains(Constants.vbLf) Then
   e.Style.Text = e.Style.CellValue.ToString().Replace(Constants.vbLf, " ")
   End If
End Sub
'Customize the column name in GroupCaptionCell.
Private Sub gridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As GridTableCellStyleInfoEventArgs)
   If e.TableCellIdentity.TableCellType = GridTableCellType.GroupCaptionCell Then
      'To change the group caption text.
      e.Style.Text = e.Style.Text.Replace(Constants.vbLf, " ")
   End If
End Sub



Before Customization

Before customize the column

After Customization

After customize the column



C#: Customize_Column Name_CS

VB: Customize_Column Name_VB

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