我有一个自定义控件,其中包含主题文件夹中的generic.xaml。我已经将构建操作设置为Resource。
现在,在App.xaml中,我使用以下命令设置对DLL的引用:
xmlns:localFolder="clr-namespace:customControl;assembly=customControl"
设置引用后,我尝试在我的App.xaml中合并资源字典,如下所示:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="localFolder;component/Themes/generic.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
但是在运行我的应用程序时,我得到了以下XAMLParseException
Attribute localFolder;component/Themes/generic.xaml value is out of range. [Line: 16 Position: 44]
发布于 2010-05-12 06:27:25
Source
应为Uri
格式- /assembly-name;component/path-to-resource
。不能用xmlns:localFolder="..."
定义XML名称空间,然后在URI字符串中使用它。这是关于被接受的格式的some reading。
https://stackoverflow.com/questions/2816414
复制