.net - Windows 7 和 Windows 8 中的 ListBox 边距不一样

标签 .net wpf windows-7 windows-8 listbox

我已经设计了一个 WPF 列表框。我是在Windows 8下开发,设置样式如下(见图),在Windows 7下测试应用时,边距不一样。正如您在图像中看到的,节点之间的间隔在 Windows 8 中为 1px,但在 Windows 7 中为 0 px。

enter image description here

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

提前致谢。

最佳答案

我实际上设法自己摆脱了它,看起来它的 ListViewItem 样式正在被 Windows8 更改,向 ListView 的本地资源添加样式对我有用。

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

关于.net - Windows 7 和 Windows 8 中的 ListBox 边距不一样,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14900132/

相关文章:

c# - 如何在 .NET 中确定我的显示器的真实像素大小?

c# - Entity Framework DB First - 模型中的继承问题

performance - MPI 应用程序中的 CPU 使用百分比

java - 使用 Java 在 Windows 7 上设置墙纸

c# - 如何将用户控件放入文档查看器中?

c++ - 将大文件从 RAM 写入磁盘

.net - 我需要帮助设置 .NET HttpWebRequest 超时

.net - 使用xUnit.net AutoRollback和多线程

.net - 自定义服务器控制导致 UpdatePanel 内的完整回发

wpf - JavaFX 与 WPF 相比如何?