So I have a Windows Universal Class Library that has a resource dictionary in it that I want to merge with my Windows 10 Universal Application's main resource dictionary in App.xaml.
My App.xaml simply merges in my main Resource dictionary from the same assembly.
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Then from my main resource dictionary (Styles/Styles.xaml) I am merging in other resource dictionaries from the same assembly. This is where I would like to merge in a resource dictionary from another assembly:
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Fields.xaml"/>
<ResourceDictionary Source="DataTemplates.xaml"/>
<!--<ResourceDictionary Source="/{AssemblyName};component/Shared.xaml" />-->
<!--<ResourceDictionary Source="pack://application:,,,/{AssemblyName};component/Shared.xaml" />-->
<ResourceDictionary Source="ms-appx:///{AssemblyName}/Shared.xaml" />
</ResourceDictionary.MergedDictionaries>
I've tried adding this to my main resource dictionary:
<ResourceDictionary Source="/{AssemblyName};component/Shared.xaml" />
and this...
<ResourceDictionary Source="ms-appx:///{AssemblyName}/Shared.xaml" />
Based on this article about Windows 8.x Store Apps this seems like how it should work. But it still doesn't work.
and this...
<ResourceDictionary Source="pack://application:,,,/{AssemblyName};component/Shared.xaml" />
(this is the WPF way, I know, but I thought I would give it a try anyway!)
But none seem to work...
The build action of the resource dictionaries that I have in my application assembly are set to 'Page'. These resource dictionaries are working simply using this in the merge:
<ResourceDictionary Source="Styles/Styles.xaml"/>
I get the following cryptic error:
Failed to assign to property 'Windows.UI.Xaml.ResourceDictionary.Source' because the type 'Windows.Foundation.String' cannot be assigned to the type 'Windows.Foundation.Uri'. [Line: 12 Position: 37]