[UWP]选择要覆盖UWP应用程序中文本的文件 [英] [UWP]Selecting a file to overwrite text in UWP app

查看:62
本文介绍了[UWP]选择要覆盖UWP应用程序中文本的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新: 这可以在桌面上运行时按预期工作,但不能在手机上运行。 所以问题与移动有关。

Update:  This works as expected while running on desktop, but not on phone.  So the question is related to mobile.

如何在UWP应用中选择要覆盖的现有文件?我尝试使用以下代码行,但它显示为2个屏幕。

How do you select an existing file to overwrite in a UWP app? I try using the following lines of code, but it appears to be 2 screens that are shown.

FileSavePicker fileSavePicker = new FileSavePicker();
StorageFile storageFile = await fileSavePicker.PickSaveFileAsync();

它将打开UI以允许我导航文件夹,但即使我选择现有文件,我必须按"下一步"按钮。 第二个用户界面将打开"输入文件名称"。 如果我输入的文件名不存在,则会创建,
将返回新文件。 如果文件名已经存在,则提示将询问我是否要覆盖。

It will open the UI to allow me to navigate folders, but even if I select an existing file, I have to press the Next button.  A second UI will open to "Enter File Name".  If I enter a file name that does not exist, it will create and return the new file.  If the file name already exist, a prompt will ask if I want to overwrite.

所以我的问题是,如何选择现有文件并返回而不必输入文件名第二个UI? 另请注意,我希望能够在此方案中选择现有文件或创建新文件。 这与在WinForms中使用SaveFileDialog类似

So my question is, how do you select an existing file and return without having to enter the file name in second UI?  Also note that I want the ability to either select an existing file or create a new file in this scenario.  This would similar to using a SaveFileDialog in WinForms.

任何帮助都表示赞赏。

推荐答案

你好shaggygi,

Hi shaggygi,

欢迎使用开发通用Windows应用程序
论坛!

作为友情提醒,请确保按照

发布指南:主题行标记

As a friendly reminder please make sure to add the appropriate tags to the title of your post as per Guide to posting: subject line tags

我已在手机和桌面测试了您的代码,我可以重现您的问题在我身边,我建议您在此UserVoice论坛上提交有关此要求的反馈和建议,( https://wpdev.uservoice.com/
给微软。 

I have tested your code in the phone and desktop, I can reproduce your issue in my side, I will recommend you submit your feedback and suggestion about this requirement on this UserVoice forum (https://wpdev.uservoice.com/) to Microsoft. 


这篇关于[UWP]选择要覆盖UWP应用程序中文本的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆