【发布时间】:2014-02-04 17:55:57
【问题描述】:
在 .NET 4.0 中,ListBox 和 ListView 的高亮显示发生了变化
下面是我多年来在 .NET 3.5 的多个地方使用的代码,当不专注时突出显示已停止在 4.0 和 4.5 上工作
<ListBox.ItemContainerStyle>
<Style>
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Red"/>
<!-- Background of selected item when focussed -->
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Pink"/>
<!-- Background of selected item when not focussed -->
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Yellow" />
</Style.Resources>
</Style>
</ListBox.ItemContainerStyle>
【问题讨论】: