dotMorten / WinUIEx

WinUI Extensions
https://dotmorten.github.io/WinUIEx
MIT License
572 stars 36 forks source link

Update WindowExtensions.Dialogs.cs - Add CreateFolderPicker() #167

Open moldypenguins opened 4 months ago

moldypenguins commented 4 months ago

CreateFolderPicker() - Creates a new instance of a FolderPicker with the provided window as a parent.

MartyIX commented 2 months ago

Not merged? :)

moldypenguins commented 1 month ago

Not merged? :)

This is what I have been using in the meantime:

  StorageFolder? programDataFolder;

  FolderPicker folderPicker = new FolderPicker();
  InitializeWithWindow.Initialize(folderPicker, App.MainWindow.GetWindowHandle());

  folderPicker.ViewMode = PickerViewMode.List;
  folderPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
  folderPicker.FileTypeFilter.Add("*");

  ProgramDataFolder = await folderPicker.PickSingleFolderAsync();
  if (ProgramDataFolder != null)
  {
    //use folder chosen
    App.ProgramDataFolder = ProgramDataFolder.Path;

  }