Skip to content

Instantly share code, notes, and snippets.

Last active Mar 18, 2022
What would you like to do?
using WindowsFolderPicker = Windows.Storage.Pickers.FolderPicker;
namespace MauiFolderPickerSample.Platforms.Windows
public class FolderPicker : IFolderPicker
public async Task<string> PickFolder()
var folderPicker = new WindowsFolderPicker();
// Get the current window's HWND by passing in the Window object
var hwnd = ((MauiWinUIWindow)App.Current.Windows[0].Handler.PlatformView).WindowHandle;
// Associate the HWND with the file picker
WinRT.Interop.InitializeWithWindow.Initialize(folderPicker, hwnd);
var result = await folderPicker.PickSingleFolderAsync();
return result.Path;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment