.net Windows phone 8从本地路径加载图像

.net Windows phone 8从本地路径加载图像,.net,windows-phone-8,xna,.net,Windows Phone 8,Xna,我需要保存Microsoft.Xna.FrameWork.Media.Picture中的图像路径,然后在代码的其他部分将此路径加载到BitmapImage,然后显示此路径。Uri保存很好,但我不明白为什么不加载图像 //Gt uri of image. I try this withnout UriKind too. //AbsoluteUri is: file:///C:/Data/Users/Public/Pictures/Sample%20Pictures/sample_photo_00.

我需要保存Microsoft.Xna.FrameWork.Media.Picture中的图像路径,然后在代码的其他部分将此路径加载到BitmapImage,然后显示此路径。Uri保存很好,但我不明白为什么不加载图像

//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);
如果我将加载图像更改为:

image = new BitmapImage(new Uri("someInternetAdress"));
没问题

谢谢你的帮助

试试这个方法:

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

它不起作用,它的行为方式仍然相同。但是谢谢你的关心,帮我解释一下好吗?什么意思?没有加载,没有任何错误,或者什么都没有发生?没有错误。当我使用组件图像显示这个时,没有什么,但如果我使用internet URL,这是有效的。