Customize the colors of metro theme in WinForms GridGroupingControl.
Customize the metro theme
WinForms GridGroupingControl has default colors for metro theme. You can customize the metro theme colors through GridMetroColors by using SetMetroStyle method and also you can set the BackColor for record plus or minus cell by using TableDescriptor or QueryCellStyleInfo event.
C#
//VisualStyles and themes
this.gridGroupingControl1.GridVisualStyles = GridVisualStyles.Metro;
GridMetroColors theme = new GridMetroColors();
theme.HeaderColor.NormalColor = Color.LightBlue;
theme.HeaderBottomBorderColor.GetBrightness();
theme.HeaderBottomBorderColor = Color.Black;
theme.HeaderColor.HoverColor = Color.BlueViolet;
theme.HeaderTextColor.NormalTextColor = Color.Black;
this.gridGroupingControl1.SetMetroStyle(theme);
'VisualStyles and themes
Me.gridGroupingControl1.GridVisualStyles = GridVisualStyles.Metro
GridMetroColors theme = New GridMetroColors()
theme.HeaderColor.NormalColor = Color.LightBlue
theme.HeaderBottomBorderColor.GetBrightness()
theme.HeaderBottomBorderColor = Color.Black
theme.HeaderColor.HoverColor = Color.BlueViolet
theme.HeaderTextColor.NormalTextColor = Color.Black
theme.GroupDropAreaColor.BackColor = Color.Azure
Me.gridGroupingControl1.SetMetroStyle(theme)
C#
this.gridGroupingControl1.TableDescriptor.Appearance.RecordPlusMinusCell.BackColor = Color.BlanchedAlmond;
VB
Me.gridGroupingControl1.TableDescriptor.Appearance.RecordPlusMinusCell.BackColor = Color.BlanchedAlmond
2.
Using QueryCellStyleInfo event
C#
this.gridGroupingControl1.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if(e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionPlusMinusCell || e.TableCellIdentity.TableCellType == GridTableCellType.RecordPlusMinusCell)
{
e.Style.BackColor = Color.BlanchedAlmond;//to change arrow colors of grid grouping control.
}
}
AddHandler gridGroupingControl1.QueryCellStyleInfo, AddressOf gridGroupingControl1_QueryCellStyleInfo
Private Sub gridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As GridTableCellStyleInfoEventArgs)
If e.TableCellIdentity.TableCellType = GridTableCellType.GroupCaptionPlusMinusCell OrElse e.TableCellIdentity.TableCellType = GridTableCellType.RecordPlusMinusCell Then
e.Style.BackColor = Color.BlanchedAlmond 'to change arrow colors of grid grouping control.
End If
End Sub
Figure 1: Customized metro style
Conclusion
I hope you enjoyed learning about how to customize the colors of the Metro theme in GridGroupingControl.
You can refer to our WinForms GridGroupingControl feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms GridGroupingControl documentation to understand how to create and manipulate data.
For current customers, you can check out our 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 other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!