TcxCustomGridTableViewStyles.OnGetSelectionStyle Event
Declaration
property OnGetSelectionStyle: TcxGridGetSelectionStyleEvent read; write;
Remarks
This event occurs every time the TcxGrid control is about to apply a style to a selected row. You can analyze the item type within the OnGetSelectionStyle
event handler to apply different formatting to different grid item types:
procedure TfrmGridOnGetSelectionStyle.cxGrid1DBTableView1StylesGetSelectionStyle(Sender: TcxCustomGridTableView;
ARecord: TcxCustomGridRecord; AItem: TObject; out AStyle: TcxStyle);
var
ASummaryItem: TcxDataSummaryItem;
begin
if AItem is TcxGridDBColumn then
case ARecord.RecordIndex mod 3 of
0: AStyle := cxStyle1;
1: AStyle := cxStyle2;
2: AStyle := cxStyle3;
end;
if not ARecord.IsData then
begin
case Sender.DataController.DataControllerInfo.DataGroups.RowInfo[ARecord.Index].Index mod 3 of
0: AStyle := cxStyle1;
1: AStyle := cxStyle2;
2: AStyle := cxStyle3;
end;
end;
if AItem is TcxDataSummaryItem then
begin
ASummaryItem := AItem as TcxDataSummaryItem;
if ASummaryItem.Index = 1 then
AStyle := cxStyle1
else
AStyle := cxStyle2
end;
if AItem is TcxDataGroupSummaryItems then
AStyle := cxStyle3;
end;
See Also