c# - 如何使用FileOpenPicker打开 'New File Dialog'? (UWP)

标签 c# uwp

我是这样编码的,

但是,这仅支持已存在的文件。

我想要“新建文件对话框”,这意味着即使我输入不存在的文件名它也可以获得路径。

        FileOpenPicker openPicker = new FileOpenPicker();
        openPicker.ViewMode = PickerViewMode.Thumbnail;
        openPicker.SuggestedStartLocation = PickerLocationId.ComputerFolder;
        openPicker.FileTypeFilter.Add(".csv");

        StorageFile file = await openPicker.PickSingleFileAsync();

        if (file != null)
        {

        }
        else
        {

        }

最佳答案

我认为您正在寻找 FileSavePicker而不是FileOpenPicker .

语法非常相似:

StorageFile file = await savePicker.PickSaveFileAsync();

关于c# - 如何使用FileOpenPicker打开 'New File Dialog'? (UWP),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48087952/

相关文章:

c# - 当 Windows Phone 应用程序处于 ARM 构建配置时,可移植类库不会重新编译

c# - 你将如何为这个 xml 文件编写一个可序列化的类?

c# - 如何在 Windows 10 IoT Core for Raspberry PI 3 中从 ASP.NET Core 2.1 调用 UWP 函数

c# - UWP Frame PageNavigation

c# - 修复 "Improper Restriction of xml external entity reference"的最佳方法是什么?

c# - 将字符串转换为时间

c# - 使用 LINQ 将列表拆分为子列表

c# - 如何从 Xamarin Forms View 创建 native UWP View ?

uwp - 如何修复 UWP 单元测试错误 "DEP3000: Attempts to stop the application failed. This may cause the deployment to fail"

c# - 初始化 MobileServicesClient 的最佳位置