Back to Devexpress

TcxGridTableViewStyles.OnGetGroupStyle Event

vcl-cxgridtableview-dot-tcxgridtableviewstyles-f0d9b151.md

latest2.0 KB
Original Source

TcxGridTableViewStyles.OnGetGroupStyle Event

Occurs when the Table View group row is painted.

Declaration

delphi
property OnGetGroupStyle: TcxGridGetGroupStyleEvent read; write;

Remarks

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:

delphi
procedure TForm1.tvCustomersStylesGetGroupStyle(Sender: TcxGridTableView; ARecord: TcxCustomGridRecord; ALevel: Integer; var AStyle: TcxStyle);
begin
  if ALevel = 0 then
    AStyle := cxStyleLevel0
  else
    AStyle := cxStyleLevel1;
end;
cpp
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.Group

TcxGridTableViewStyles.OnGetGroupSummaryStyle

Style Repository

TcxGridTableViewStyles Class

TcxGridTableViewStyles Members

cxGridTableView Unit