Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In WinRT XAML, how to reference images in outside/separate assembly/project?

Seems to be different in WinRT (Windows 8). Anyone figure it out yet?

My experiments.

Of course:

File Build Action == Content && Copy to Output Directory == Copy always

These don't seem to work:

<Image Source="Folder/file.jpg" />
<Image Source="/Folder/file.jpg" />
<Image Source="Namespace;Folder/file.jpg" />
<Image Source="Namespace;/Folder/file.jpg" />
<Image Source="pack://Namespace;Folder/file.jpg" />
<Image Source="pack://Namespace;/Folder/file.jpg" />

Out of desperation I tried:

File Build Action == Embedded Resource && Copy to Output Directory == Copy always

Still fail. Ugh!

like image 552
Jerry Nixon Avatar asked Jun 08 '12 20:06

Jerry Nixon


1 Answers

<Image Source = "ms-appx:///<projectName>/<folderName>/<contentName>" />

For example ...

<Image Source = "ms-appx:///ClassLibrary1/Content/myimage.png" />

See How to Reference Content for a bit more info.

like image 179
JP Alioto Avatar answered Dec 02 '22 18:12

JP Alioto