ListBox边距在Windows 7和Windows 8中不同

Dan*_*lba 11 .net wpf listbox windows-7 windows-8

我已经设计了一个WPF ListBox.我正在Windows 8下开发.设置样式后如下(见图),当我在Windows 7中测试应用程序时,边距不一样.正如您在imagen中看到的那样,节点之间的分离在Windows 8中为1px,在Windows 7中为0 px.

在此输入图像描述

你知道为什么会这样,以及如何解决它?

提前致谢.

And*_*ndy 7

我实际上设法自己摆脱它,它看起来像是由Windows8改变的ListViewItem样式,为ListView的本地资源添加样式对我有用.

    <ListView.Resources>
        <Style TargetType="ListViewItem">
            <Setter Property="Margin" Value="0"/>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="BorderThickness" Value="0"/>
        </Style>
    </ListView.Resources>
Run Code Online (Sandbox Code Playgroud)