开发者

How to read a image from isolated-storage and display it on Image element?

开发者 https://www.devze.com 2023-03-02 11:21 出处:网络
I need to load an image from IsolatedStorage, and display it on an Image UIElement. I have surveyed MSDN, and I found I cannot get an Uri from IsolatedStorage. I could get a stream for the saved jpeg

I need to load an image from IsolatedStorage, and display it on an Image UIElement. I have surveyed MSDN, and I found I cannot get an Uri from IsolatedStorage. I could get a stream for the saved jpeg image file.

After I get the jpeg file stream, how do I show it on an Image element? 开发者_C百科


Use BitmapImage.SetSource to read the stream and then set the Image.Source to the BitmapImage:

Stream jpegStream;
var image1 = new BitmapImage();
image1.SetSource(jpegStream);
Image image = new Image();
image.Source = image1;
0

精彩评论

暂无评论...
验证码 换一张
取 消