private async void TakeSnapShotButton_Click(object sender, RoutedEventArgs e) { CameraCaptureUI ccu = new CameraCaptureUI(); ccu.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Png; ccu.PhotoSettings.AllowCropping = false; StorageFile photo =await ccu.CaptureFileAsync(CameraCaptureUIMode.Photo); if (photo is null) return; else { TemporaryPhotoFile = photo; BitmapImage bitMapImage = new BitmapImage(); FileRandomAccessStream fRAS = (FileRandomAccessStream)await photo.OpenAsync(FileAccessMode.Read); bitMapImage.SetSource(fRAS); yourPhoto.Source = bitMapImage; /// 保存 StorageFile文件到磁盘 StorageFolder destinationFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync (yourName.Text,CreationCollisionOption.OpenIfExists); await photo.MoveAsync(destinationFolder, "ProfilePhoto.jpg", NameCollisionOption.ReplaceExisting); await photo.DeleteAsync(); } }