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.
|
We can modify some properties of the item.
Notice that the detail data is in ItemData
property.
|
And now, if we want to change the detail text color without using the Style Designer
dialog, we can handle the event OnApplyStyleLookup
.
|
After that, apply some pre-defined style to the item.
|
Finally, add the item to the ListBox, so that it will appear on it.
|
And here is the final key to achieve our goal.
|
Demo:
Ref:
Is posible set red color to one value in detail section of one ListBoxItem?