在WPF应用程序Mahapps中找不到资源字典

时间:2015-08-21 16:03:02

标签: c# wpf mahapps.metro

我已经按照文档进行了操作,并且该应用程序第一次在我的项目中运行良好。今天为了学习mahapps上的一些东西,我已经下载了github上提供的演示,并且Nuget修复了一些缺失的资源,这里也没问题一切都运行良好。当我重新打开我的项目时,我看到UI的预览显示了经典的VS控件而不是mahapps的控件,同样在App.xml文件中这一行:

<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" />

                <!-- accent resource -->
                <!-- change "Cobalt" to the accent color you want -->

                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Cobalt.xaml" />

                <!-- theme resource -->
                <!-- change "BaseLight" to the theme you want -->
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
            </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>

显示此消息:

  

查找资源字典时出错

发生什么事了?一切都很完美!

1 个答案:

答案 0 :(得分:0)

我有同样的问题。当用较新版本的VS(VS 2015)打开项目时,我尝试在VS2012和2013开放它工作正常。我似乎是VS 2015设计师的一个问题。