TMSFMXGrid Programmatically changing style

I've adapted fairly well to FMX instead of VCL but I have run into a bit of problem and hope somebody else can help so I dont need to spend hour after hour trying to figure this out.

I've got a TMSFMXGrid running in virtual mode. It runs perfectly, even with 100 000 + rows. I have one style issue, however, and that is that I cannot seem to figure out how to programmatically change the color of the selected row(s) or the alternate bands. (I use SelectionMode=smDisjunctRow by the way)

Still being fairly new to FireMonkey, I'm sorry if this is trivially easy and I am just know familiar with the solution.


You can programmatically change the layout of the cell.
The cell state parameter can be used to determined whether a cell is selected.

procedure TForm1.TMSFMXGrid1GetCellLayout(Sender: TObject; ACol, ARow: Integer;
  ALayout: TTMSFMXGridCellLayout; ACellState: TCellState);
  if (ACellState = csSelected) then
    ALayout.Fill.Color := claRed;
  else if ACellState = csFocused then
    ALayout.Fill.Color := claBlue;

Kind Regards, 

Pieter Scheldeman2015-04-29 09:03:52