Hello,
Welcome to Microsoft Q&A!
The FileOpenPicker, FileSavePicker, and FolderPicker APIs require an HWND associated with them so that they know which window is the target window they need to show over. If you are trying to use FolderPicker in a WinUI3 application, you will need to get the current HWND and set the HWND on the picker.
Like this:
var Picker = new FolderPicker();
// Get the current window's HWND by passing in the Window object
var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(this);
// Associate the HWND with the file picker
WinRT.Interop.InitializeWithWindow.Initialize(Picker, hwnd);
Picker.FileTypeFilter.Add("*");
var folder = await Picker.PickSingleFolderAsync();
Thank you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.