Ada*_*son 5 wpf xaml resourcedictionary
我有两个程序集,每个程序集都提供了一组我希望包含在我的应用程序中的通用样式和资源.我正在使用合并的词典App.xaml来加载它们,并且在运行时它们很好.不幸的是,这些资源不会在设计时加载,在我的错误窗口中填充有关无法解析的资源的消息,并给我一个不代表实际显示内容的UI.
这是我现在的App.xaml:
<Application x:Class="ClientDebug.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Dai.Common;component/Xaml/Common.xaml" />
<ResourceDictionary Source="/Dai.DevExpress;component/Xaml/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
Run Code Online (Sandbox Code Playgroud)
对于这两个合并的词典,我在"错误"窗口中收到以下错误:
Error 11 An error occurred while finding the resource dictionary "/Dai.Common;component/Xaml/Common.xaml". C:\DevProjects\Core Application\ClientDebug\App.xaml 12 17 ClientDebug
Error 12 An error occurred while finding the resource dictionary "/Dai.DevExpress;component/Xaml/Styles.xaml". C:\DevProjects\Core Application\ClientDebug\App.xaml 13 17 ClientDebug
Run Code Online (Sandbox Code Playgroud)
这显然缺乏有用的信息.同样,它们在运行时加载正如您所期望的那样,但在设计时没有任何资源可用.
我在来自其他命名空间的字典前面加上“pack://application:,,,”,如下所示:
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Wsi.Util;component/DataGrid/NameValueDataGridDictionary.xaml" />
<ResourceDictionary Source="LayoutStylesDictionary.xaml" />
<ResourceDictionary Source="pack://application:,,,/Wsi.Util;component/controls/ToolBarResources.xaml" />
<ResourceDictionary Source="pack://application:,,,/Wsi.Common;component/view/themes/FilterStylesResourceDictionary.xaml" />
</ResourceDictionary.MergedDictionaries>
Run Code Online (Sandbox Code Playgroud)
哈特哈,
珍妮
| 归档时间: |
|
| 查看次数: |
3278 次 |
| 最近记录: |