Windows Store Development Tips and Tricks 5 : Content Referencing using URIs
Beginning Windows 8? These tips will help you master it. Trick 5: Content Referencing using URIs
You have nice images, videos, web pages and other
kind of content files in your project.
And you don't know how to reference them dynamically?
The given code example will help you load an image dynamically:
image1.Source = new BitmapImage(new Uri("ms-appx:///Assets/welcome.png"));
As you well know generally we would access a content using BitMapImage with its UriKind parameter.
In XAML based apps,there is no such relative path because every app is deployed as a package.so vs2012 provides us a scheme to access content files in a folder: "ms-appx:///FolderName/contentfile"
You can use ms-appx scheme to access your files dynamically.