How can I configure my list to display different background colors, for example, in the image below?

My list refers to a data source (Livebindng). I want to use a color field to set the backgroud color.
I set up my view in this way:
- 3 Text elements (designation, date and summary)
- 1 Bitmap Element (Couleur)
Text elements are tied to a data source, but there is no way to bind my bitmap to the color field.

I filled out the ActivesUpdateObjects event list, but this is not enough, since the bitmap does not change when updating the datasource data record!
procedure TfrmMain.lvTachesActivesUpdateObjects(const Sender: TObject; const AItem: TListViewItem); begin SetItemColor(AItem); end; procedure TfrmMain.SetItemColor(const AItem: TListViewItem; const UpdateColor: Boolean = False); var LObject: TListItemImage; VC: TColor; begin LObject := AItem.Objects.FindObjectT<TListItemImage>('Couleur'); VC:= dtmMain.qrTaches.FieldByName('couleur').AsInteger; if LObject.Bitmap = nil then begin LObject.Bitmap := FMX.Graphics.TBitmap.Create(10,240); LObject.Bitmap.Clear(VC); end else if UpdateColor then LObject.Bitmap.Clear(VC); end;
Is there a better way? I also looked o use style, but it appears (or I did not find) that itemlistview cannot apply style!
Ps: Firemonkey / Windows / Delphi Berlin XE10.1
delphi firemonkey
Stephane wierzbicki
source share