【发布时间】:2017-05-11 15:22:11
【问题描述】:
我已将一些功能/文件从一个解决方案复制到另一个解决方案。
在解决方案 1 中,我有包含文件夹的 Windows 应用程序 DemoApp1:
- 壳牌
- 功能区/资源
在 Shell/ShellView.xaml 中
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Ribbon/Resources/Ribbon.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
上面的工作没有问题。
在解决方案 2 中,我的 Windows 应用程序 DemoApp2 功能很少。 App-class 继承自 C# 类库 DemoApp2Feature 中的一个类,该类可以完成大部分工作。
类库 DemoApp2Feature 中的 Shell 和 Ribbon 文件夹结构和文件相同。然而,上面的结果是:
XamlParseException 'Set property 'System.Windows.ResourceDictionary.Source' throw an excetion'。
当我查看 VS2015 异常详细信息时,BaseUri 看起来像这样:
{pack://application:,,,/DemoApp2Feature;component/shell/shellview.xaml}
我想在 DemoApp2Feature 中也保持文件和文件夹结构相同,因为有几十个文件具有这些 MergedDictionaries 定义。那么我怎样才能知道在哪里寻找 DemoApp2Feature 的 ResourceDictionaries 的基础是什么。
【问题讨论】:
标签: wpf xaml resourcedictionary