c# - Change color of selected items in listbox -
this question has answer here:
currently when item selected (but control not) item in light grey (almost not visible) - happens when load window , programatically set selecteditems (restore user had done) - until click on item selections pretty not visible.
so want change color of selected item in listbox ... have today:
<listbox name="lbdates" selectionmode="multiple" itemssource="{binding days}" selecteditem="{binding path=selecteddays, mode=twoway}"> </listbox>
you can create style listboxitem , apply triggers on it
<style x:key="listboxitemstyle" targettype="{x:type listboxitem}"> <style.triggers> <trigger property="isselected" value="true> <setter property="background" value="#e8ebee" /> </trigger> </style.triggers> </style>
and apply list box style
<style x:key="listboxstyle" targettype="{x:type listbox}"> <setter property="itemcontainerstyle" value="{staticresource listboxitemstyle}" /> </style>
Comments
Post a Comment