簡體   English   中英

Wpf-Application 在 Windows 10 上看起來不同

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM