Skip to main content

TcxGridTableViewStyles.OnGetGroupStyle Event

Occurs when the Table View group row is painted.

Declaration

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:

procedure TForm1.tvCustomersStylesGetGroupStyle(Sender: TcxGridTableView; ARecord: TcxCustomGridRecord; ALevel: Integer; var AStyle: TcxStyle);
begin
  if ALevel = 0 then
    AStyle := cxStyleLevel0
  else
    AStyle := cxStyleLevel1;
end;

The result of this customization is displayed below:

See Also