I have a simple metro app that allows the user to take a picture and then display that picture in a small thumbnail off to the side, the code block that does this is:
ImageEncodingProperties imageProp = ImageEncodingProperties.CreateJpeg();
var photoStream = new InMemoryRandomAccessStream();
await mediaCaptureManager.CapturePhotoToStreamAsync(imageProp, photoStream);
var bmpImg = new BitmapImage();
await bmpImg.SetSourceAsync(photoStream);
imageOne.Source = bmpImg;
This throws an exception on the line:
await bmpImg.SetSourceAsync(photoStream);
Saying:
The component could not be found
MSDN documents show that you're supposed to use SetSourceAsync
when setting a BitmapImage
source, but I have no idea why this isn't working. Any ideas?