You can also use Launcher.LaunchFolderAsync and use the second Folder​Launcher​Options parameter.
Folder​Launcher​Options can make the file or folder that you want to select using ItemsToSelect .
ItemsToSelect is a ItemsToSelect -only property, but you can add items to an existing list.
Here is an example, getting the folder using FolderPicker , and then selecting all the files:
The first is to get the folder:
FolderPicker p = new FolderPicker(); p.FileTypeFilter.Add(".txt"); StorageFolder folder = await p.PickSingleFolderAsync();
And then get all the files in the folder
foreach (var temp in await folder.GetFilesAsync())
I can use FolderLauncherOptions to add the item I want to select.
var t = new FolderLauncherOptions(); foreach (var temp in await folder.GetFilesAsync()) { t.ItemsToSelect.Add(temp); }
Then open file explorer
await Launcher.LaunchFolderAsync(folder, t);
You can see that Explorer will open when all files are selected.
You can also add folders to ItemsToSelect and it will be selected.
See here https://docs.microsoft.com/en-us/uwp/api/Windows.System.Launcher#Windows_System_Launcher_LaunchFolderAsync_Windows_Storage_IStorageFolder_Windows_System_FolderLauncherOptions_
source share