I have a Universal Windows application that hosts a main menu. I want a plugin architecture, where the menu items are added from class libraries.
But I can't seem to load images correctly. I can't get the ms-appx:///
working, and when I try to add the images as an embedded resource, it hangs:
var assembly = typeof(CookModule).GetTypeInfo().Assembly;
using (var imageStream = assembly.GetManifestResourceStream("My.Namespace.Folder.ImageName-100.png"))
using (var raStream = imageStream.AsRandomAccessStream())
{
var bitmap = new BitmapImage();
bitmap.SetSource(raStream); //<- Hangs here
I get no exceptions, errors in the output or anything. It just hangs there, and the app simply doesn't load the page.
I have also tried:
var bitmap = new BitmapImage(new Uri("/Folder/ImageName-100.png"));
I'm missing something similar to the WPF pack uri's where I can state which assembly to load the image from.
What is the correct (and working) way of adding a image resource to a Page from a class libary? (Or does anyone have a working example of ms-appx where the image is in a class library)