Reader Level:
ARTICLE

Windows Store Development Tips and Tricks 5 : Content Referencing using URIs

Posted by Ibrahim Ersoy Articles | Windows Store Apps September 07, 2012
Beginning Windows 8? These tips will help you master it. Trick 5: Content Referencing using URIs
  • 0
  • 0
  • 2560

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:
 
using Windows.UI.Xaml.Media.Imaging;
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.
  

COMMENT USING

Trending up