c# - how to change listBox item font colour from code behind -
i have tried access listbox items properties this:
mylistbox.items[0]
and set foreground property unknow me reason cant access way. can using code behind - , if yes - how?
implement itemtemplate , bind brush foreground property.
you should implement inotifypropertychanged in binding object , notify on mycolorbrush value change.
<listbox itemssource="{binding myitems}"> <listbox.itemtemplate> <datatemplate> <textblock text="{binding mytext}" foreground="{binding mycolorbrush}"/> </datatemplate> </listbox.itemtemplate> </listbox>
Comments
Post a Comment