由网友(人不犯二枉少年i)分享简介:我有一个非常简单的WPF的ListBox用的SelectionMode设置为多。I have a really simple WPF ListBox with SelectionMode set to Multiple.当ListBox中失去焦...
我有一个非常简单的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>
相关推荐
最新文章