Value is out of Range Exception While setting ResourceDictionary Source to CustomControl's generic.XAML
I have a custom Control which contains the generic.xaml inside the Themes folder. I have set the build action to Resource.
Now from App.xaml I am setting the reference to the DLL by using :
x开发者_StackOverflowmlns:localFolder="clr-namespace:customControl;assembly=customControl"
After the reference is set I am trying to Merge the Resource dictionary in my App.xaml as follow:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="localFolder;component/Themes/generic.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
But while running my application I am getting the following XAMLParseException
:
Attribute localFolder;component/Themes/generic.xaml value is out of range. [Line: 16 Position: 44]
Source
should be in the Uri
format - /assembly-name;component/path-to-resource
. You can't define an XML namespace with xmlns:localFolder="..."
and then use it in the URI string. Here is some reading on the accepted formats.
精彩评论