【问题标题】:Save Image from My Pictures Folder to Local App Folder in Windows 8 Metro App在 Windows 8 Metro App 中将图像从“我的图片”文件夹保存到本地应用程序文件夹
【发布时间】:2023-03-15 16:52:01
【问题描述】:

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

【问题讨论】:

    标签: image binding windows-8 microsoft-metro windows-runtime


    【解决方案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);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-13
      • 1970-01-01
      • 1970-01-01
      • 2015-04-14
      • 1970-01-01
      相关资源
      最近更新 更多