Windows 7和Windows 8中的ListBox边距不同 [英] ListBox margin is not the same in Windows 7 and Windows 8

查看:108
本文介绍了Windows 7和Windows 8中的ListBox边距不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了WPF ListBox的样式.我正在Windows 8下进行开发.将样式设置如下(见图)后,当我在Windows 7中测试应用程序时,余量是不一样的.如您在图像中所见,在Windows 8中节点之间的间隔为1像素,在Windows 7中为0像素.

I have styled an WPF ListBox. I'm developing under Windows 8. After setup the style to be as follows (see image), when I test the application in Windows 7, the margin is not the same. As you can see in the imagen the separation between nodes is 1px in Windows 8, but 0 px in Windows 7.

您知道这是为什么以及如何解决吗?

Do you know why is this, and how to solve it?

提前谢谢.

推荐答案

我实际上设法摆脱了它,看起来Windows8正在更改它的ListViewItem样式,从而为ListView的本地资源添加了样式为我工作.

I actually managed to get rid of it myself, it looks like it's ListViewItem style that's being changed by Windows8, adding a style to the local resources of the ListView has worked for me.

    <ListView.Resources>
        <Style TargetType="ListViewItem">
            <Setter Property="Margin" Value="0"/>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="BorderThickness" Value="0"/>
        </Style>
    </ListView.Resources>

这篇关于Windows 7和Windows 8中的ListBox边距不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆