[英]Wpf-Application looks different on windows 10
我用一个列表框创建了 WPF 应用程序,其中包含 windows7 的复选框(checklistbox)。 我在 Windows 10 上安装了相同的应用程序,GUI 看起来非常不同。 在Windows 7 上,检查列表框在同一行中。 但是在Windows 10 上,框更高,文本更低(请参见图片)
<ListBox x:Name="lbSchlagwoerter" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinWidth="300" MaxHeight="390" Grid.Row="1" Grid.RowSpan="3" Grid.Column="3" Margin="5,5,5,5">
<ListBox.Resources>
<Style TargetType="ListBoxItem">
<Setter Property="OverridesDefaultStyle" Value="true" />
<Setter Property="SnapsToDevicePixels" Value="true" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<CheckBox Margin="5,2" IsChecked="{TemplateBinding IsSelected}">
<ContentPresenter />
</CheckBox>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.Resources>
</ListBox>[enter image description here][1]
您可以将 VerticalContentAlignment 设置为 Center。
<CheckBox VerticalContentAlignment="Center"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.