Sunday, August 26, 2012

How to : Load resource stream in WinRT / windows 8

Here is one quick tutorial showing you how to access embedded resource in winRT, which is much easier than windows phone 7.
Create one empty project Named App1, right click assets folder to create one text file, and right click the properties of the file, change the build action to embedded resource.
image

Now you can using the following code to query the available resource names.

image

please note, the GetTypeInfo method is one extension method, so you need put the System.Reflection in your using area.

similarly, you can using the code to get the stream reference, and read all the content.
image

 
Locations of visitors to this page