列表/组合框背景和选定的颜色.net 4.5

我有一个应用程序在 Windows 7和更低版本上运行愉快,以.net 4框架为目标.
如果应用程序现在安装在Windows 8(运行.net 4.5,但仍然定位.net 4),它将显示列表框或组合框中的选定项目的蓝色背景,以及重点项目的白色背景.有没有删除这个?
我在我的XAML中使用以下内容来设置问题的风格,这似乎解决了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>
我忘了回来,我如何解决这个问题….原来,所有你需要做的,它创建一个空的项目容器样式,并将其分配到你的列表框/组合框等….你可以使用这个以及保持您可能使用的当前样式,如ListBox Style =“{StaticResource CurrentStyle}”ItemContainerStyle =“{StaticResource BlankListBoxContainerStyle}”/>其中BlankListBoxContainerStyle会像…
<Style x:Key="BlankListBoxContainerStyle" targettype="{x:Type ListBoxItem}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate targettype="{x:Type ListBoxItem}">
                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="FocusVisualStyle"
            Value="{x:Null}"/>
</Style>

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...