6

I have a class library with a custom control in UWP. There is an asset image.png that is in the class library under the folder Assets

I want to display this image in the custom control using xaml syntax in generic.xaml inside the class library.

troty_master
  • 315
  • 1
  • 2
  • 11

1 Answers1

12

That took me quite a while to solve, so I am posting the outcome for future explorers of the topic since I didn't manage to find a good solution anywhere.

Location of the files is: ClassLibraryName/Assets/image.scale-100.png ClassLibraryName/Assets/image.scale-150.png etc.

Build action: Content Copy to Output Directory: Do not Copy

In generic.xaml I have this now and the image loads correctly: Image Source="../ClassLibraryName/Assets/image.png"

It also works like this: Image Source="ms-appx:///ClassLibraryName/Assets/image.png"

troty_master
  • 315
  • 1
  • 2
  • 11