Search code examples
windows-8

Windows 8 App: Why must I specify ms-appx:/// in my image source URL?


I've been looking at the XAML Images sample project and the XAML to load an image in that sample looks like this:

<Image Source="Assets/image1.jpg"/>

However, in my own project I find that I cannot load any images like that. If I try I get E_NETWORK_ERROR when I handle the ImageFailed. Instead, I discovered that I have to use the ms-appx:/// prefix like this:

<Image Source="ms-appx:///Assets/image1.jpg"/>

Then it works. Any ideas what's different about my project vs the sample that would cause this?


Solution

  • Have you tried "<Image Source="/Assets/image1.jpg>"?