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

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -