1

我有一个项目有几个解决方案。在我的核心解决方案中,我有一个包含我的主题的主题文件夹。在 shell 解决方案和App.xaml文件中,我想解决我的主题。像这样:

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/Hezareh.Core;component/Themes/CustomDocumentViewerTemplate.xaml" />
            <ResourceDictionary Source="/Hezareh.Core;component/Themes/Darkness.xaml" />
            <ResourceDictionary Source="/Hezareh.Core;component/Themes/Generic.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

但我收到此错误:

设置属性“System.Windows.ResourceDictionary.Source”引发异常。

4

2 回答 2

0

您可以像这样更改代码:

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/Hezareh.Core;component/Themes/CustomDocumentViewerTemplate.xaml" />
                <ResourceDictionary Source="pack://application:,,,/Hezareh.Core;component/Themes/Darkness.xaml" />
                <ResourceDictionary Source="pack://application:,,,/Hezareh.Core;component/Themes/Generic.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
于 2012-12-03T09:59:40.753 回答
0

我自己找到了解决这个问题的方法。

为了解决这个问题,我们应该右键单击主题文件并单击属性。

在属性窗口上,大多数将构建操作设置为页面。

于 2012-12-04T08:23:17.410 回答