2

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:

Project structure

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?

Arlo
  • 963
  • 3
  • 11
  • 20

1 Answers1

3

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>
Jérôme Laban
  • 5,224
  • 3
  • 20
  • 17