首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用wp8.1的FileSavePicker复制.png

如何使用wp8.1的FileSavePicker复制.png
EN

Stack Overflow用户
提问于 2015-02-20 14:57:05
回答 1查看 254关注 0票数 0

如何使用FileSavePicker从appdata:/assets/ *.png复制图像。我发现这个例子是File Save Picker - Save Edited Image (C# Metro app)的,但是它不工作。

我有这样的代码:

代码语言:javascript
复制
private async void OpenButton_Click(object sender, RoutedEventArgs e)
    {

        string path = @"\Assets\Logo.png";
        StorageFolder folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
        StorageFile file = await folder.GetFileAsync(path);

        // Show the picker
        FileSavePicker savePicker = new FileSavePicker();
        // Set the file that will be saved
        savePicker.SuggestedSaveFile = file;
        savePicker.SuggestedFileName = "Logo";
        savePicker.FileTypeChoices.Add("PNG", new List<string>() { ".png" });
        savePicker.PickSaveFileAndContinue();



    }

但他将文件保存为0字节

EN

回答 1

Stack Overflow用户

发布于 2015-02-20 16:50:26

你试过msdn上的样品了吗?你找到的那一个哪里出了问题?

代码语言:javascript
复制
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
savePicker.FileTypeChoices.Add("Plain Text", new List<string>() { ".txt" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "New Document";

来源:

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28623267

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档