How to LiveBind Firemonkey TListbox that has a Custom Style?


By eelias Following the EMB example “Custom List” found in “RAD Studio12.0SamplesFireMonkeyCustomListBox”

It demonstrated by code how to have Items customized on the ListBox.

Inserting one Item on the TListBox by code:

// create custom item
Item := TListBoxItem.Create(nil);
Item.Parent := ListBox1;
Item.StyleLookup := ‘CustomItem’;
Item.Text := ‘item ‘ + IntToStr(Item.Index); // set filename
if Odd(Item.Index) then
Item.ItemData.Bitmap := Image1.Bitmap // set thumbnail
Item.ItemData.Bitmap := Image2.Bitmap; // set thumbnail
Item.StylesData[‘resolution’] := ‘1024×768 px’; // set size
Item.StylesData[‘depth’] := ’32 bit’;
Item.StylesData[‘visible’] := true; // set Checkbox value

I want to do the same using LiveBinding exclusively.

I could success show the style and bind some of the items:

And some of the LiveBindings (using a prototype):

And this is a piece of the custom style from the delphi example:

My questions:

How can I access the other 3 defined items to fill up with data?
How can I get the event from the Button and CheckBox (both going to same event handler)
How can I make that works in a frame? There is no working StyleBook component at design time
Bonus question 🙂

Is it possible to have all above working with a StyleBook exclusive for this …read more

Via: StackOverflow

Comments are closed.