使用相机拍照并在Image控件中显示
var cameraCaptureUI = new CameraCaptureUI();
//对相机进行一些设置,还有很多,这里只设置了格式
cameraCaptureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;
Storage file = await cameraCaptureUI.CaptureFileAsync(CameraCaptureUIMode.Photo);
if (file == null)
return;
BitmapImage bi = new BitmapImage();
using (IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.ReadWrite))
{
bi.SetSource(stream);
}
MyImage.Source = bi;
myImage是Image控件