【发布时间】:2012-10-07 22:21:34
【问题描述】:
在我的项目中,我试图嵌入来自 Avalon Wizard 的源代码,但发生了一些奇怪的事情,我无法成功集成它。
我的自定义控件库中有以下结构
- 向导
- 主题
- Aero.NormalColor.xaml
- Aero2.NormalColor.xaml
- AeroWizardHeader.xaml
- Generic.xaml
- Wizard97.xaml
- WizardAero.xaml
- Generic.xaml
- 主题
- 主题
- Generic.xaml
在我的 Generic.xaml 中,我有以下声明
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CuratioCMS.Client.UI;Component/Wizard/Themes/Generic.xaml" />
</ResourceDictionary.MergedDictionaries>
Wizard/Themes/Generic.xaml 里面是我定义 MergedDictionaries 的方式
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CuratioCMS.Client.UI;Component/Wizard/Themes/Wizard97.xaml" />
<ResourceDictionary Source="CuratioCMS.Client.UI;Component/Wizard/Themes/WizardAero.xaml" />
<ResourceDictionary Source="CuratioCMS.Client.UI;Component/Wizard/Themes/AeroWizardHeader.xaml" />
</ResourceDictionary.MergedDictionaries>
根据 Avalon 的实现,在 Aero.NormalColor.xaml 中还提供了一个 MergedDictionary,看起来像这样
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CuratioCMS.Client.UI;Component/Wizard/Themes/AeroWizardHeader.xaml" />
</ResourceDictionary.MergedDictionaries>
我的问题是我无法在我的项目中使用我自己的类库,因为设计器抛出异常:找不到资源'wizard/themes/curatiocms.client.ui;component/wizard/themes/ Wizard97.xaml'。
如果我更改 Wizard/Theme/Generic.xaml 中的路径,则错误消失,但 Wizard 无法提供 Aero 功能,甚至设计器也无法按预期工作。
我还要说,我决定采用这种架构是因为根据扩展的 WPF 工具包,这是一种非常干净的方式。
谁能帮我解决这个问题?
【问题讨论】:
-
好的,我将 CuratioCMS.Client.UI;Component/Wizard/ 更改为 /CuratioCMS.Client.UI;Component/Wizard/ 所以我在开头添加了 / 符号,但仍然无法获得 Aero 效果我确定字典有问题,因为如果我将所有内容从 Wizard 文件夹中移出,它就可以工作
标签: wpf xaml custom-controls resourcedictionary