My Metroapp is not showing images!

If you're working in code-behind, are trying to load an included BitmapImage and your app, although it loads, is not showing the image, it might be because you're not using the appropriate protocol. In the Windows 8 Consumer Preview, the correct protocol for loading included images is ms-appx:

BitmapImage img = new BitmapImage(new Uri("ms-appx:///Images/my_image.png", UriKind.RelativeOrAbsolute));

In the above case, the image is set as Content (for C#-projects; Image for C++ ones) and resides in the Images solution folder.

For more information about loading images, please see Microsoft's official sample App tiles and badges sample.

Comments

Popular posts from this blog

Auto Mapper and Record Types - will they blend?

Unit testing your Azure functions - part 2: Queues and Blobs

Testing WCF services with user credentials and binary endpoints