Articles in this section
Category / Section

How to customize the caption text in the grid in WinForms GridGroupingControl?

1 min read

Customize the caption text

To customize the GroupCaptionCell text, you can make use of QueryCellStyleInfo event.  The caption text can be validated by using TableCellIdentity.TableCellType change its style.

C#

void hierarchyGrid_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
    //to customize the caption cell
    if (e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell)
    {
        e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
    }
}

VB

Private Sub hierarchyGrid_QueryCellStyleInfo(ByVal sender As Object, ByVal e As GridTableCellStyleInfoEventArgs)
  'to customize the caption cell
  If e.TableCellIdentity.TableCellType = GridTableCellType.GroupCaptionCell  Then
  e.Style.HorizontalAlignment = GridHorizontalAlignment.Right
  End If
End Sub

ScreenshotCaption text aligned to the right side

Samples:

C#: CustomizeCaptionText_CS

VB: CustomizeCaptionText_VB

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