var ext = new Dictionary<string, IList<string>>(); ext.Add("Plain Text", new List<string>() { ".txt" });
var picker = await FileAndFolderPickerHelper.PickSaveFileAsync(App.currentWindow, ext); // or // var picker = await FileAndFolderPickerHelper.PickSaveFileAsync(hwnd, ext); if (picker != null) { txtRes.Text = picker.Path; }
PickMultipleFilesAsync
1 2 3 4 5 6 7 8 9 10 11 12 13 14
var fileTypeFilter = new List<string> { ".txt", ".rtf" }; var picker = await FileAndFolderPickerHelper.PickMultipleFilesAsync(App.currentWindow, fileTypeFilter);
// or // var picker = await FileAndFolderPickerHelper.PickMultipleFilesAsync(hwnd, fileTypeFilter);
if (picker != null) { foreach (var item in picker) { txtRes.Text = item.Path; } }
PickSingleFileAsync
1 2 3 4 5 6 7 8 9 10
var fileTypeFilter = new List<string> { ".txt", ".rtf" }; var picker = await FileAndFolderPickerHelper.PickSingleFileAsync(App.currentWindow, fileTypeFilter);
// or // var picker = await FileAndFolderPickerHelper.PickSingleFileAsync(hwnd, fileTypeFilter);
if (picker != null) { txtRes.Text = picker.Path; }
PickSingleFolderAsync
1 2 3 4 5 6 7 8 9
var picker = await FileAndFolderPickerHelper.PickSingleFolderAsync(App.currentWindow);
// or // var picker = await FileAndFolderPickerHelper.PickSingleFolderAsync(hwnd);
if (picker != null) { txtRes.Text = picker.Path; }