How to set backcolor for group header in WinForms GridGroupingControl?
Change the backcolor for group header cell
You can change the backColor for each group header cell, based on the content in the WinForms GridGroupingControl by using QueryCellStyleInfo event. In this event, you can check the celltype as GroupCaptioncell and also apply the color for SummaryCell based on the content.
// to apply the summary color for 1st level
this.gridGroupingControl1.Appearance.AnySummaryCell.BackColor = Color.FromArgb(255, 231, 162);
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if(e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell)
{
// content text and 1st level
if(e.Style.Text == "1 Items" && e.TableCellIdentity.DisplayElement.ChildTableGroupLevel==1)
{
e.Style.BackColor = Color.FromArgb(255, 231, 162);
}
// 2nd level groupedcolumn
else if (e.TableCellIdentity.DisplayElement.ChildTableGroupLevel == 2)
{
e.Style.BackColor = Color.LightGreen;
}
}
// apply the summary color for level 2
if(e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Summary && e.TableCellIdentity.DisplayElement.ChildTableGroupLevel == 2)
{
e.Style.BackColor = Color.LightGreen;
}
}'Apply summary color for 1st level
Me.gridGroupingControl1.Appearance.AnySummaryCell.BackColor = Color.FromArgb(255, 231, 162)
Private Sub gridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As GridTableCellStyleInfoEventArgs)
If e.TableCellIdentity.TableCellType = GridTableCellType.GroupCaptionCell Then
'Content text and 1st level
If e.Style.Text = "1 Items" AndAlso e.TableCellIdentity.DisplayElement.ChildTableGroupLevel = 1 Then
e.Style.BackColor = Color.FromArgb(255, 231, 162)
'2nd level grouped column
ElseIf e.TableCellIdentity.DisplayElement.ChildTableGroupLevel = 2 Then
e.Style.BackColor = Color.LightGreen
End If
End If
'Apply summary color for level 2
If e.TableCellIdentity.DisplayElement.Kind = DisplayElementKind.Summary AndAlso
e.TableCellIdentity.DisplayElement.ChildTableGroupLevel = 2 Then
e.Style.BackColor = Color.LightGreen
End If
End SubThe following screenshot displays the Backcolor for GroupHeaderCell and SummaryCell.

Figure 1: Backcolor for GroupHeaderCell and SummaryCell
Samples: Color_GroupHeaderCell809696102.zip
Conclusion
I hope you enjoyed learning about how to set the backcolor for group header cell based on the content in WinForms GridGroupingControl.
You can refer to our WinForms GridGroupingControl’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms GridGroupingControl 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 GridGroupingControl 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 forums, Direct-Trac, or feedback portal. We are always happy to assist you!