首页 > 解决方案 > WPF 设计器问题(mahapps Metro)?

问题描述

我刚开始使用 WPF,但是我有一个问题,它在设计器中看起来像这样是否正常: Designer

但如果我运行我的应用程序,它看起来像这样:运行

有没有办法解决这个问题,或者它在 WPF 中是否正常?

XAML 源代码:

<Controls:MetroWindow
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
                      xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
                      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="IXWare_Designed.MainWindow"
                      Title="Test"
                      WindowStartupLocation="CenterScreen" WindowStyle="SingleBorderWindow" ResizeMode="CanMinimize" d:DesignWidth="906" d:DesignHeight="474">

    <Controls:MetroWindow.RightWindowCommands>
        <Controls:WindowCommands>
            <Button Content="settings" Click="Button_Click" />
        </Controls:WindowCommands>
    </Controls:MetroWindow.RightWindowCommands>

    <Grid>
        <TabControl HorizontalAlignment="Left" VerticalAlignment="Top" Height="445" Width="900">

            <TabItem Header="TabItem" Margin="0,0,-60,0">
                <TabControl HorizontalAlignment="Left" Margin="0,0,-6,-1" Width="900">
                    <TabItem Header="TabItem"/>
                    <TabItem Header="TabItem"/>
                    <Button Content="Button" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75"/>
                    <Button Content="Button" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75"/>
                </TabControl>
            </TabItem>
            <TabItem Header="TabItem" Margin="0,0,-60,0"/>
            <TabItem Header="TabItem" Margin="0,0,-60,0"/>
            <TabItem Header="TabItem" Margin="0,0,-60,0"/>
            <TabItem Header="TabItem" Margin="0,0,-60,0"/>
            <TabItem Header="TabItem" Margin="0,0,-60,0"/>
            <TabItem Header="TabItem" Margin="0,0,-60,0"/>
            <TabItem Header="TabItem" Margin="0,0,-48,0"/>

        </TabControl>
    </Grid>

</Controls:MetroWindow>

标签: c#.netwpfwpf-controlsmahapps.metro

解决方案


推荐阅读