WindowsAppSDK
                                
                                
                                
                                    WindowsAppSDK copied to clipboard
                            
                            
                            
                        New File/Folder picker for WinAppSDK
Proposal: New File/Folder picker for WinAppSDK
Summary
This proposal introduces an attempt to design a new UWP File/Folder picker for Reunion that overcomes the limitations of the UWP File/Folder picker currently available in the SDK
Rationale
Listed below are the limitations of the current File/Folder picker
- Unable to pick files and folders in a single instance of the picker dialog
 - Unable to pick multiple folders
 
This proposal attempts to address the above issues for down-level OS'es (RS1 and higher).
Scope
| Capability | Priority | 
|---|---|
| This proposal will allow developers to pick files and folders in a single instance of the picker dialog | Must | 
| This proposal will allow developers to pick multiple folders | Must | 
| This proposal will allow developers to specify paths that are outside the application install path (with permissions) | Must | 
| This proposal will allow applications to pick Files/Folders on behalf of a user | Could | 
| This proposal will allow applications to customize the File/Folder dialog (within limitations) | Should | 
Important Notes
Open Questions
- Will applications need special permissions to use the file/folder picker other than storage permissions.
 
It would also be helpful to enable developers to freely set the picker's start location. Currently, these pickers have a SuggestedStartLocation API which only lets the developer pick from a small set of (common) file system locations (such as the user's desktop or download folder). This API could be changed to accept any file/folder path the developer wants to specify, for example like this:
public string SuggestedStartLocation { get; set; }
to be used like:
var filePicker = new FileOpenPicker()
{
    SuggestedStartLocation = "MyCustomFolderFilePath"
}
Developers would still be able to easily set the start location to the folders they currently can pick for the SuggestedStartLocation like this:
var filePicker = new FileOpenPicker()
{
    SuggestedStartLocation = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures)
};
This would also help mitigate the UX issue being called out in issue #45.
Also FilePicker doesn't allow apps to add custom options like it can be done with open and save as dialog boxes in case of win32 apps:


Being able to add custom options like in can be done with print dialog will also be helpful.
Also consider defining proper AutomationIds, currently two properties (ComboBox and TextBox in ComboBox) have automation id of 1148, in the OS file picker. This makes UI testing tricky.
Not sure if this gets implemented in the OS, as a Reunion UI/framework - or if it comes with the forthcoming Windows 10X Files app - but these old UI surfaces, should be replaced with Xaml UIs - for apps compiled using Reunion APIs
Please do not forget other applications able to provide "file" as the "Camera" app in Windows 10
WinRT apps support picking files from other app, and on Windows 10, it is implemented like a hack, with XAML UI showing in a cutout of the Old Explorer based file picker.
One protential usage would be like calling Camera app to take selfees when uploading profile pictures.
This feature is currently not available in Win32 Apps.
The new file picker should be fully WinUI based, and add support for this in Win32 Apps. It could be done with a path to a temp file, and automatically deleted after the file is closed by the app.
Just linking to this WinUI topic, where we are discussing building a new Reunion WinUI File Picker Dialog for this API proposal https://github.com/microsoft/microsoft-ui-xaml/issues/2854
Mockup Dialog components
Mockup Dialog "file providers"
I would love a folder picker where as a developer I can suggest a OneDrive folder. Right now I can provide a suggestion that the folder picker start in the My Documents folder, but I can't then recommend that it start in an actual useful sub-folder like 'My Documents\Roaming_Bookmarks'
Here's my scenario: I want people to be able to pick a folder that will be used to synchronize some bookmark data. Each computer they run on, they have to pick the same folder (this assumes that they want their bookmarks to roam; if they don't, the default is to just store them locally). But users are terrible at picking a folder!
- By default, I can point them to the My Documents folders, but this clutters up the Documents folder.
 - I can pop up a dialog and suggest to users that they pick a folder on OneDrive, but I can't set what that folder is
 - When they do the same thing on a new computer, they have to remember which folder they picked before, and that's hard
 
TL/DR: save folder picker should let me as a developer specify a currently non-existing OneDrive folder by name that will be created if the user agree
@ZenBird Any updates on this based on the feedback thus far?
Can we get some indication where this proposal stands?
Is it being actively considered or worked on?
What version of Reunion is this likely to land in?
WinRT apps support picking files from other app, and on Windows 10, it is implemented like a hack, with XAML UI showing in a cutout of the Old Explorer based file picker.
One protential usage would be like calling Camera app to take selfees when uploading profile pictures.
This feature is currently not available in Win32 Apps.
The new file picker should be fully WinUI based, and add support for this in Win32 Apps. It could be done with a path to a temp file, and automatically deleted after the file is closed by the app.
Unlike Windows 8, both file pickers in UWP and Win32 almost look the same except a few minor differences. File Picker contract is powerful however you don't get them when you are working with Win32 apps which shouldn't be the case in the first place. However the WinRT file picker returns a StorageFile which not only can represents a file on the filesystem but also something provided by another app. The old File Picker API however returns the path and I'm not sure how would that work with these apps if they aren't stored on the local file system. Anyway the old API could become a wrapper on top of FileOpenPicker and return the path property on it. Another thing is there are even older file pickers which sometimes show up in certain apps from pre-Vista era which needs to be replaced with a modern one.
Just came across this and have the same problem, not even attaching the window handle works.
Currently also the FileOpenPicker only has FileTypeFilter which doesn't let you name the type of file displayed in the dialog (only list extensions), see this Stack Overflow question from years ago here: https://stackoverflow.com/questions/32201831/how-to-properly-specify-fileopenpicker-filetypefilter-syntax-for-uwp
Which is weird, as the FileSavePicker takes a map to enable this scenario with FileTypeChoices.
The FileOpenPicker should also just use the same map as FileTypeChoices as well so that file type names (along with those with multiple extensions like images can be grouped).
Listed below are the limitations of the current File/Folder picker Unable to pick files and folders in a single instance of the picker dialog Unable to pick multiple folders
IFileDialogCustomize does that
So it's only been three and a half years since this request was made. The usability of the FileOpenPicker and FolderPicker is practically zero. I have a UI with three FileOpenPickers from three distinct folders that never change. But I literally have to re-select each folder every time the dialog pops up because it doesn't have a start location. How do you expect developers to adopt WinUI for web and mobile application development if the UX is like this? Please please please fix these controls.
Its unbelievable, that we can't set a custom start location in the FileOpenPicker. What a shame!
Being unable to set the start location for the FileOpenPicker and FileSavePicker in WinUI 3 is a HUGE drawback. Basically, we are unable to help the user pick the places where he has recently been opening or saving files. All modern Windows application has this, and our application cannot provide it. This is a MUST HAVE in future versions of the Windows App SDK!!!
Basically, we are unable to help the user pick the places where he has recently been opening or saving files.
@BendicoE I believe you can achieve this by setting the SettingsIdentifier property.
@JaiganeshKumaran I believe this only works within an application session. Our application persists recently used files and places between sessions and even after rebooting the system. Or am I misunderstanding something here?
The existing folder picker is also a huge flaw in design. I have hundreds of users who are constantly confusing a folderdialog with a filedialog, expecting them to be able to see their files present when browsing for a folder. When the files are missing (because this is a folder dialog), they think the app is broken or not detecting files they should be seeing. The windows forms folder dialog was much more intuitive
The windows forms folder dialog was much more intuitive
This is SHBrowseForFolder, that you can call in WinUI