繁体   English   中英

可视化Mahapps地铁样式时出错

[英]Error visualizing Mahapps metro style

我正在尝试在带有Windows 7的VS2013中使用Mahapps的Metro Style v1.0稳定版。根据快速入门部分的初步修改,主窗口应如下所示:
在此处输入图片说明
但看起来像这样:
在此处输入图片说明

当我使用0.7版本时,效果很好。
其他人有没有经历过?

有趣的事实:

第二张图片就是我得到的,它保存为.jpeg,但是当我将截图保存为.png格式时,它看起来像这样: 在此处输入图片说明

您应该始终拥有以下基本内容

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>

窗口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();
    }
  }
}

希望这可以帮助!

您可以在GitHub MahApps.Metro的非常简单的示例上看到如何实现所有操作。您肯定忘记了在xaml页面中删除或添加名称空间或不删除窗口参数。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM