我使用一个包含windows7复选框(复选框)的列表框创建了WPF应用程序。我在windows 10上安装了相同的应用程序,GUI看起来非常不同。在Windows 7上,同一行中的复选框。但是在windows 10上,box是更高的,而文本是更低的(请参见图)

<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]发布于 2019-06-18 12:52:18
您可以将VerticalContentAlignment设置为中心。
<CheckBox VerticalContentAlignment="Center"
https://stackoverflow.com/questions/56646637
复制相似问题