C# Wpf应用程序在windows 10上看起来不同
我用一个列表框创建了WPF应用程序,其中包含windows7的复选框(checklistbox)。我在windows 10上安装了相同的应用程序,GUI看起来非常不同。在Windows7上,选中同一行中的复选框。但是在Windows10上,框较高,文本较低(请参见图片)C# Wpf应用程序在windows 10上看起来不同,c#,wpf,windows-7,listbox,windows-10,C#,Wpf,Windows 7,Listbox,Windows 10,我用一个列表框创建了WPF应用程序,其中包含windows7的复选框(checklistbox)。我在windows 10上安装了相同的应用程序,GUI看起来非常不同。在Windows7上,选中同一行中的复选框。但是在Windows10上,框较高,文本较低(请参见图片) [在此处输入图像描述][1] 您可以将垂直内容对齐设置为中心 它与VerticalContentAlignment配合使用,非常感谢您Avinash:) <ListBox x:Name="lbSchlagwoerter
[在此处输入图像描述][1]
您可以将垂直内容对齐设置为中心
它与VerticalContentAlignment配合使用,非常感谢您Avinash:)
<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]