ertank 29 Posted yesterday at 09:40 AM Hello, I want to conditionally change stock ImageListItemBottomDetail appearance TListViewItem (not the list but a single item) background color at runtime. Stylebook - background changes for whole background as far as I can see. Any help is appreciated. Thanks & Regards, Ertan Share this post Link to post
Kazantsev Alexey 26 Posted yesterday at 08:07 PM type TForm1 = class(TForm) ListView1: TListView; procedure FormCreate(Sender: TObject); procedure ListView1UpdateObjects(const Sender: TObject; const AItem: TListViewItem); procedure FormDestroy(Sender: TObject); private FCustomItem : TListViewItem; FBitmap : TBitmap; public { Public declarations } end; var Form1: TForm1; implementation {$R *.fmx} procedure TForm1.FormCreate(Sender: TObject); begin for var i := 1 to 25 do ListView1.Items.Add.Text := Format('item #%u', [i]); FCustomItem := ListView1.Items[4]; FCustomItem.Text := 'Custom Background Item'; var c := TAlphaColorRec.Orangered; TAlphaColorRec(c).A := 64; FBitmap := TBitmap.Create(8, 8); FBitmap.Clear(c); end; procedure TForm1.FormDestroy(Sender: TObject); begin FBitmap.Free; end; procedure TForm1.ListView1UpdateObjects(const Sender: TObject; const AItem: TListViewItem); begin if AItem = FCustomItem then begin var Bkgnd := TListItemImage.Create(nil); Bkgnd.ScalingMode := TImageScalingMode.Stretch; Bkgnd.OwnsBitmap := False; Bkgnd.Bitmap := FBitmap; AItem.View.Insert(0, Bkgnd); end; end; custom_bkgnd_item.zip 2 Share this post Link to post
Serge_G 88 Posted 14 hours ago I wrote some tips about TListview you can find here (in French) , or in this tutorial 1 Share this post Link to post
ertank 29 Posted 8 hours ago @Kazantsev Alexeysolution worked just fine. Thank you. @Serge_Gthank you, too. Share this post Link to post