0
我試圖將圖像加載到我的win8應用程序的圖像UI項目中。但到目前爲止,我無法將所選圖像顯示在用戶界面上。 有人可以告訴我如何正確的做法嗎?將圖像加載到WinRT中的圖像UI項目
Windows.Storage.Pickers.FileOpenPicker OpenPicker = new Windows.Storage.Pickers.FileOpenPicker();
OpenPicker.FileTypeFilter.Add(".jpg");
OpenPicker.FileTypeFilter.Add(".bmp");
Windows.Storage.StorageFile picture = await OpenPicker.PickSingleFileAsync();
imgPreview.Source = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri(picture.Path, UriKind.Absolute));
imgPreview.Stretch = Stretch.Fill;
imgPreview.Visibility = Windows.UI.Xaml.Visibility.Visible;