可附加物业' MergedDictionaries'没有找到类型资源字典'

时间:2016-01-30 13:23:44

标签: c# wpf mergeddictionaries

<Application x:Class="mahaapswpf.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.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>
    </Application.Resources>
</Application>

我试图使用MahApps.Metro框架,我应该将其包含在我的App.xaml中,但我得到了#34;不支持嵌套属性:ResourceDictionaries.MergedDictionaries&#34 ;错误和&#34;可附加属性&#34; MergedDictionaries&#34;在类型&#34;资源字典&#34;。

中找不到

我已经尝试了一切,但仍无法解决这个问题。任何的想法?感谢。

1 个答案:

答案 0 :(得分:11)

您缺少实际创建ResourceDictionary实例的标记:

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            ...
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>