错误可视化Mahapps地铁风格

时间:2014-12-03 13:51:33

标签: c# visual-studio-2013 nuget-package mahapps.metro

我试图在Windows 7的VS2013中使用Mahapps的Metro Style v1.0稳定版。根据quick start部分的初始修改,主窗口应该如下所示:
enter image description here
但是看起来像这样:
enter image description here

当我使用0.7版时,工作正常 还有其他人经历过这个吗?

有趣的事实:

第二张图片是我得到的,它保存在.jpeg中,但当我以.png格式保存截图时,它看起来像这样: enter image description here

2 个答案:

答案 0 :(得分:1)

您应该始终拥有这些基本的stuff

<强>的App.xaml

<Application x:Class="WpfApplication.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
  <Application.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </Application.Resources>
</Application>

Window xaml

<controls:MetroWindow x:Class="WpfApplication.MainWindow"
                      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"
                      Title="MainWindow"
                      Height="600"
                      Width="800">
  <Grid>
    <!-- now your content -->

  </Grid>
</controls:MetroWindow>

后面的窗口xaml代码

using System;
using MahApps.Metro.Controls; // MahApps.Metro reference

namespace WpfApplication
{
  public partial class MainWindow : MetroWindow
  {
    public MainWindow()
    {
      InitializeComponent();
    }
  }
}

希望这有帮助!

答案 1 :(得分:0)

您可以通过非常简单的示例了解如何将所有内容实施到GitHub MahApps.Metro 当然,您忘记删除或添加xaml页面中的命名空间或不删除窗口参数。