Articles in this section
Category / Section

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

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

The screenshot below shows the caption text customization.

Caption 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)
Access denied
Access denied