如何从隔离存储中读取图像并将其显示在 Image 元素上? [英] How to read a image from isolated-storage and display it on Image element?
本文介绍了如何从隔离存储中读取图像并将其显示在 Image 元素上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从 IsolatedStorage,并将其显示在 Image UIElement 上.我调查了 MSDN,发现我无法从 IndependentStorage 获取 Uri.我可以获得保存的 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.
获得 jpeg 文件流后,如何将其显示在 Image 元素上?
After I get the jpeg file stream, how do I show it on an Image element?
推荐答案
使用 BitmapImage.SetSource 读取流然后将 Image.Source 设置为 BitmapImage:
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;
这篇关于如何从隔离存储中读取图像并将其显示在 Image 元素上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文