How to change background color of an TListview item?


How can I customize my listview to display different background colors like in the picture below ?

My listview is bound to a datasource (Livebindng). I want to use the color field to set my backgroud color.

I’ve customized my view this way :

3 Text items (Designation,Date and Resume)
1 Bitmap item (Couleur)

Text items are bound to datasource but there is no way to bind my Bitmap to my “color” field.

I’ve filled the listview ActivesUpdateObjects event but this is not enought as bitmap is not changed when datasource record is updated !

procedure TfrmMain.lvTachesActivesUpdateObjects(const Sender: TObject;
const AItem: TListViewItem);


procedure TfrmMain.SetItemColor(const AItem: TListViewItem; const UpdateColor:
Boolean = False);
LObject: TListItemImage;
VC: TColor;
LObject := AItem.Objects.FindObjectT<TListItemImage>(‘Couleur’);
VC:= dtmMain.qrTaches.FieldByName(‘couleur’).AsInteger;
if LObject.Bitmap = nil then

LObject.Bitmap := FMX.Graphics.TBitmap.Create(10,240);
end else if UpdateColor then LObject.Bitmap.Clear(VC);


Is there a better way to proceed ? I was also looking o use style but it appears (or I didn’t find) that an itemlistview can’t apply style !

Ps : Firemonkey / Windows / Delphi Berlin XE10.1

Comments are closed.