【发布时间】:2019-07-31 19:14:33
【问题描述】:
此处是 WPF 进程的新手,并尝试定义在实用程序 DLL 中维护的合并字典集合的合并字典。我正在尝试解决资源位置错误。
错误
- IOException:找不到资源“ui/wpf/imagelist16x16.xaml”
Theme.xaml
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/UI/WPF/ImageList16x16.xaml" />
<!--Future xaml file references-->
</ResourceDictionary.MergedDictionaries>
<Style x:Key="EmptyStyle"/>
</ResourceDictionary>
ImageList16x16.xaml
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:clr="clr-namespace:System;assembly=mscorlib">
<BitmapImage x:Key="Accept" UriSource="UI/Resources/Images16x16/accept.png"/>
</ResourceDictionary>
用户控制资源参考
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BHP_Utilities;component/UI/WPF/Theme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
执行时,会根据其中的字典引用找到 Theme.xaml,因为发生错误。两个 xaml 文件的 构建选项 是 Page 并且 Custom Tool 属性设置为 XamlIntelliSenseFileGenerator。
【问题讨论】:
标签: c# wpf xaml resourcedictionary