ListBox margin is not the same in Windows 7 and Windows 8

后端 未结 2 1142
感情败类
感情败类 2021-02-20 02:39

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 th

相关标签:
2条回答
  • 2021-02-20 03:15

    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>
    
    0 讨论(0)
  • 2021-02-20 03:25

    The default ListBoxItem contains a border. The ListBoxItem also specifies a padding which is inherited by this Border. Its the Padding DP that needs to be set like what Andy mentioned.

    0 讨论(0)
提交回复
热议问题