I'm building an Uno app and need to reference a Resource Dictionary defined and stored in the Shared Project.
The project is set up like so:
And in MainPage.xaml
, I'm using:
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///LaunchShowcase.Shared/Themes/CenteredPivotHeadersStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>
This results in the error message Cannot locate resource from 'ms-appx:///LaunchShowcase.Shared/Themes/CenteredPivotHeadersStyle.xaml'
What's the proper way to reference this resource dictionary?
The shared project is not a "real" project, as would a library. The resource dictionary file is behaving as if it were directly integrated in the head project, therefore the name LaunchShowcase.Shared
does not exist.
Try using this instead:
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///Themes/CenteredPivotHeadersStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>