I have an application that's been running happily on windows 7 and below targeting the .net 4 framework.
If the application is now installed in windows 8 (Running .net 4.5 but still targeting .net 4) it shows a blue background for a selected item in a listbox or combobox and a white background for a focused item. Is there anyway to remove this?
I'm using the following in my XAML to set the style in question which seemed to resolve the issue before windows 8.
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/>
</Style.Resources>
</Style>
</ListBox.ItemContainerStyle>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…