public async Task <string?> ShowFolderDialogAsync(OpenFolderDialog dialog, Window parent) { var filePicker = parent.StorageProvider; if (!filePicker.CanPickFolder) { return(null); } var options = dialog.ToFolderPickerOpenOptions(); var folders = await filePicker.OpenFolderPickerAsync(options); return(folders .Select(f => f.TryGetUri(out var uri) ? uri.LocalPath : null) .FirstOrDefault(u => u is not null)); }