AechoLiu
AechoLiu

Reputation: 18368

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

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?

Upvotes: 3

Views: 1745

Answers (1)

Michael S. Scherotter
Michael S. Scherotter

Reputation: 10785

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;

Upvotes: 4

Related Questions