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.
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With