-1

我正在使用一个按钮从图片文件夹中选择一个图像,我想要将所选图像保存到应用程序的本地存储中,以便能够使用 GridView 中的绑定显示该图像。这可能吗?我怎么能做到?谢谢

4

1 回答 1

1

你会这样做:

FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
openPicker.FileTypeFilter.Add(".jpg");
openPicker.FileTypeFilter.Add(".jpeg");
openPicker.FileTypeFilter.Add(".png");

StorageFile file = await openPicker.PickSingleFileAsync();
if (file != null)
{
    await file.CopyAsync(Windows.Storage.ApplicationData.Current.LocalFolder);
}
于 2012-09-24T17:38:53.290 回答