Ghost1372

everything can be handy

FileAndFolderPickerHelper

PickSaveFileAsync

1
2
3
4
5
6
7
var ext = new Dictionary<string, IList<string>>();
ext.Add("Plain Text", new List<string>() { ".txt" });
var picker = await FileAndFolderPickerHelper.PickSaveFileAsync(App.currentWindow, ext);
if (picker != null)
{
txtRes.Text = picker.Path;
}

PickMultipleFilesAsync

1
2
3
4
5
6
7
8
9
var fileTypeFilter = new List<string> { ".txt", ".rtf" };
var picker = await FileAndFolderPickerHelper.PickMultipleFilesAsync(App.currentWindow, fileTypeFilter);
if (picker != null)
{
foreach (var item in picker)
{
txtRes.Text = item.Path;
}
}

PickSingleFileAsync

1
2
3
4
5
6
var fileTypeFilter = new List<string> { ".txt", ".rtf" };
var picker = await FileAndFolderPickerHelper.PickSingleFileAsync(App.currentWindow, fileTypeFilter);
if (picker != null)
{
txtRes.Text = picker.Path;
}

PickSingleFolderAsync

1
2
3
4
5
var picker = await FileAndFolderPickerHelper.PickSingleFolderAsync(App.currentWindow);
if (picker != null)
{
txtRes.Text = picker.Path;
}

WinUICommunity

Demo

you can run demo and see this feature.

0%