Windows phone 8 load image from local path

I need save path of image from Microsoft.Xna.FrameWork.Media.Picture and then in other parts of the code load this path to BitmapImage and then show this. Uri save is fine, but i can not figure out why image is not load.

//Gt uri of image. I try this withnout UriKind too.
//AbsoluteUri is: file:///C:/Data/Users/Public/Pictures/Sample%20Pictures/sample_photo_00.jpg
//LocalPath is: C:\Data\Users\Public\Pictures\Sample Pictures\sample_photo_00.jpg
uri = new Uri(picture.GetPath(), UriKind.Absolute);


//Create BitmapImage from Uri. 
BitmapImage image = new BitmapImage(photo.Url);

If I change the loading image to:

image = new BitmapImage(new Uri("someInternetAdress"));

It´s load ok.

thank you for helping!

Answers


Try this method:

Uri uri = new Uri(picture.GetPath(), UriKind.Relative);
StreamResourceInfo resourceInfo = Application.GetResourceStream(uri);
BitmapImage image = new BitmapImage();
image.SetSource(resourceInfo.Stream);

Need Your Help

jasmine: Adding and reading a query string in the url?

javascript jasmine

Simply put, in the end, i want to grab the query string from the url and add it to my cookie.

Java EE, JDBC and Tomcat

java-ee tomcat jdbc wamp

I'm trying to get data from a database using JSPs, but I get the following error when running it on server. Can anyone tell me what's wrong and show me how to fix it please?