Background Color for TTMSFMXTableView

I've been trying to change the background color for the tableview, using the Fill property, drilling down into the GetListxxx functions, canvas etc., nothing seems to work. How do I change the background color in code - not with styles.


Thanks.

Hi, 


You can use the following code to accomplish this

  TMSFMXTableView1.NeedStyleLookup;
  TMSFMXTableView1.ApplyStyleLookup;
  (TMSFMXTableView1.GetListBackGround as TRectangle).Fill.Color := claRed;

Hi Pieter!


Thanks for this. Unfortunately This doesn't work. I'm running this in the constructor of the custom tableviewex. Perhaps I should do this somewhere else? Like in the item oncustomize or onpaint/painting? Here's what I'm calling:

  TRectangle(GetListBackGround).Fill.Color := TAlphaColorRec.White;

The GetListBackGround is the background container behind the items, not the items itself. Can you specify exactly which elements you want to be styled?

I want to set the color of the background of the list object itself - TTableViewEx - to white. This is not the list items, but the list container itself that contains the items.


The color that you see when the tableview is aligned TAlignLayout.Client but you don't have enough items to fill the tableview. The default color is some form of grey. I want to change that to white.

Okay figured this one out - needed to set ApplyStyle to True.


However when I do this my items are no longer selected in dark blue like they were before, and that second row in the list item is now in white font and disappears when the item is selected.

Okay, figured it out:


AItem.Shape.FillSelected.Color := TAlphaColorRec.Royalblue;
In the OnCustomize event