更改选定而散列表框风格不被变灰 [英] Change selected and unfocused Listbox style to not be grayed out
本文介绍了更改选定而散列表框风格不被变灰的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个非常简单的WPF的ListBox用的SelectionMode设置为多。
I have a really simple WPF ListBox with SelectionMode set to Multiple.
<ListBox SelectionMode="Multiple" />
当ListBox中失去焦点这真的很难说什么被选中,因为从蓝色选择的颜色变为浅灰色。有什么改变,使其保持蓝色这种行为的最简单的方法是什么?
When the ListBox loses focus it's really hard to tell what's been selected because the selection colour changes from blue to a light grey colour. What's the easiest way of changing this behaviour so that it stays blue?
我知道这可能是与该列表项的风格,但我找不到在哪里。
I know it's probably something to do with the ListItem's style, but I can't find where.
干杯。
类似的: WPF的ListView非活动选择颜色
推荐答案
我做了这样的事情用一个合并的ResourceDictionary以下,它可以帮助你:
I have done something like this using the following in a merged ResourceDictionary, it may help you:
<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>
这篇关于更改选定而散列表框风格不被变灰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文