当Listbox失去焦点的时候,选中项会从蓝色变成灰色,灰色不大醒目,我们想看清我们选中的是哪一项比较困难,下面的代码可以在Listbox失去焦点的时候把选中项仍然置为蓝色。
<Style TargetType="ListBoxItem">
    
<Style.Resources>
        
<!--SelectedItem with focus-->
        
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="LightBlue" Opacity=".4"/>
        
<!--SelectedItem without focus-->
        
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="LightBlue" Opacity=".4"/>
    
</Style.Resources>
</Style>

 

posted on 2009-04-16 10:55  pdfw  阅读(8382)  评论(0编辑  收藏  举报