wpf - ListBox: Item selected is not highlighted -


in wpf application, have simple listbox:

                 <listbox x:name="lbutilities">                     <listboxitem tag="2" content="one" isselected="true" />                     <listboxitem tag="5" content="two" />                  </listbox> 

the problem when listbox appears first time, selected item ("one") not highlighted. if click on item, gets highlighted. how have selected default item highlighted system color?

thanks.

it selected need hightlight not focused

<listbox grid.row="0" x:name="lbutilities">     <listbox.itemcontainerstyle>         <style targettype="listboxitem">             <style.triggers>                 <trigger property="isselected" value="true" >                     <setter property="fontweight" value="bold" />                     <setter property="background" value="transparent" />                     <setter property="foreground" value="black" />                 </trigger>             </style.triggers>             <style.resources>                 <solidcolorbrush x:key="{x:static systemcolors.highlighttextbrushkey}" color="black"/>                 <!-- background of selected item when focussed -->                 <solidcolorbrush x:key="{x:static systemcolors.highlightbrushkey}" color="lightcyan"/>                 <!-- background of selected item when not focussed -->                 <solidcolorbrush x:key="{x:static systemcolors.controlbrushkey}" color="lightgray" />             </style.resources>         </style>     </listbox.itemcontainerstyle>     <listboxitem tag="2" content="one" isselected="true"/>     <listboxitem tag="5" content="two" /> </listbox> 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -