vcl-cxgridtableview-dot-tcxgridtableviewstyles-f0d9b151.md
Occurs when the Table View group row is painted.
property OnGetGroupStyle: TcxGridGetGroupStyleEvent read; write;
You can handle the OnGetGroupStyle event to redefine style for the Table View group rows. This event occurs every time when it is necessary to redraw a group row defined by the ARecord parameter. The ALevel parameter specifies the current nesting level.
The Sender parameter determines the Table View containing the row.
The following simple code colors groups based on their level. cxStyleLevel0 and cxStyleLevel1 represent TcxStyle objects created using the style repository. The Color property of the styles is set to $007A96E9 and $00CDEBFF respectively:
procedure TForm1.tvCustomersStylesGetGroupStyle(Sender: TcxGridTableView; ARecord: TcxCustomGridRecord; ALevel: Integer; var AStyle: TcxStyle);
begin
if ALevel = 0 then
AStyle := cxStyleLevel0
else
AStyle := cxStyleLevel1;
end;
void TForm1::tvCustomersStylesGetGroupStyle(TcxGridTableView *Sender, TcxCustomGridRecord *ARecord, int ALevel, TcxStyle *&AStyle)
{
if (ALevel = = 0) AStyle = cxStyleLevel0;
else AStyle = cxStyleLevel1;
}
The result of this customization is displayed below:
See Also
TcxGridTableViewStyles.OnGetGroupSummaryStyle