C++Builder Firemonkey ListBoxItem Detail Color

The detail text color setting of ListBoxItem is defined in style, so if we want to change the color, we must duplicate a style and then modify its definitions in the FireMonkey Style Designer ourselves. There is no way to change the color of detail data at design time currently. However, we can customize the style settings by handling some events that will retrive style definitions and then use FindStyleResource to get an instance of the resource object.

Assume that you have a form with a TListBox named ListBox1.
To add an item to the ListBox, we must create an TListBoxItem object.

TListBoxItem *item = new TListBoxItem(ListBox1);

We can modify some properties of the item.
Notice that the detail data is in ItemData property.

item->Height = 50;
item->Text = "This is the text.";
item->ItemData->Detail = "This is the detail";

And now, if we want to change the detail text color without using the Style Designer dialog, we can handle the event OnApplyStyleLookup.

item->OnApplyStyleLookup = ListBoxItem1ApplyStyleLookup;

After that, apply some pre-defined style to the item.

item->StyleLookup = "listboxitembottomdetail";

Finally, add the item to the ListBox, so that it will appear on it.

ListBox1->AddObject(item);

And here is the final key to achieve our goal.

void __fastcall TfrmMain::ListBoxItem1ApplyStyleLookup(TObject *Sender)
{
TListBoxItem *item = dynamic_cast<TListBoxItem *>(Sender);
if (item == NULL)
return;

TFmxObject *obj = dynamic_cast<TFmxObject *>(Sender)->FindStyleResource("detail");
if (obj != NULL)
{
TActiveStyleTextObject *asto =
dynamic_cast<TActiveStyleTextObject *>(obj);
if (asto != NULL)
{
asto->Color = claRed;
}
}
}

Demo:
Imgur

Ref:
Is posible set red color to one value in detail section of one ListBoxItem?