I try to set the property of an object when filling a ListBox
with ListBoxItems
. The object is an ellipse added to the style used by the ListBox
. The line of code below raises an exception:
ListBoxItem.StylesData['ellipsestyle.fill.Gradient.Points.Points[0].Color'] := newAlphaColor;
As a workaround, I tried to reach the property by getting the ellipsestyle
object with ListBoxItem.FindStyleRessource
, but the function returns nil
.
Thank you !
StylesData
can`t provide access to 'complex' properties. you can do next workaround:About
FindStyleResource
:First place, where you can get access to style object -
OnApplyStyleLookup
event of specified ListBoxItem. BeforeOnApplyStyleLookup
(for example - immediatelly after creating Listboxitem) you cannot get access to style.So, move your code to
ListBoxItem.OnApplyStyleLookup
and change it like this:Also, you can force load style (this is not recommended way - by default, style for object loaded at the time of first painting):