Skip to content

Conversation

@DinahK-2SO
Copy link
Contributor

@DinahK-2SO DinahK-2SO commented Dec 3, 2025

This pull request updates the Storage.Pickers API specifications to add new customization and usability features to the FileOpenPicker, FileSavePicker, and FolderPicker classes. The changes introduce properties for dialog title and persistent settings, allow specifying the default file type filter, and add support for picking multiple folders. These enhancements are reflected in both the API definitions and usage examples.

Adds properties:

Title

  • Adds Title properties to FileOpenPicker, FileSavePicker, and FolderPicker, enabling custom dialog titles and persistent picker state across sessions. ([1], [2], [3], [4], [5], [6])

Related:

SettingsIdentifier

  • Adds SettingsIdentifier properties to FileOpenPicker, FileSavePicker, and FolderPicker, enabling custom dialog titles and persistent picker state across sessions. ([1], [2], [3], [4], [5], [6])

Related:

FileTypeIndex

  • Adds FileTypeIndex property to FileOpenPicker and FileSavePicker, allowing developers to set the default selected file type filter by index (1-based). This is documented and shown in usage examples. ([1], [2], [3], [4], [5], [6], [7], [8])

Related:

FileSavePicker.ShowOverwritePrompt & FileSavePicker.CreateNewFileIfNotExists

  • Adds 2 new properties for FileSavePicker: ShowOverwritePrompt and CreateNewFileIfNotExists.
    • ShowOverwritePrompt default to true and control whether the picker warns about overwriting when user picked an existing file via FileSavePicker.
    • CreateNewFileIfNotExists default to true and control whether to auto-create an empty file when the picked file doesn't exists.

Related:

Adds method:

FolderPicker.PickMultipleFoldersAsync

  • Adds PickMultipleFoldersAsync method to FolderPicker, enabling selection of multiple folders in a single operation. API definitions, documentation, and code samples have been updated to reflect this feature. ([1], [2], [3]`)

Related:

@DinahK-2SO DinahK-2SO force-pushed the user/DinahK-2SO/spec_settingsidentifier_filetypefilterindex_title branch from e8f4450 to 7af6a89 Compare December 4, 2025 08:00
@ghost1372
Copy link
Contributor

@DinahK-2SO
here is other related issues which can be closed:
#5847
#5827

@DinahK-2SO DinahK-2SO changed the title Official API Review for new functionalities of Storage.Pickers: SettingsIdentifier; FileTypeIndex; Title; FolderPicker.PickMultipleFoldersAsync Official API Review for new functionalities of Storage.Pickers: SettingsIdentifier; FileTypeIndex; Title; PickMultipleFoldersAsync; ShowOverwritePrompt; CreateNewFileIfNotExists Dec 4, 2025
Copy link
Member

@kmahone kmahone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

…ndex_title' of github.com:microsoft/WindowsAppSDK into user/DinahK-2SO/spec_settingsidentifier_filetypefilterindex_title
string SettingsIdentifier;

IMap<string, IVector<string>> FileTypeChoices{ get; };
IVector<string> FileTypeFilter{ get; };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have both FileTypeChoices and FileTypeFilter?

Why does FileSavePicker only have FileTypeChoices?

Since FileSavePicker does not have FileTypeFilter, how does DefaultFileTypeFilterIndex work?

Copy link
Contributor Author

@DinahK-2SO DinahK-2SO Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kmahone , thanks for bringing up this topic! I have added a note for the file type related properties.

In short:

  1. We can see FileTypeChoices is an more customizable version of FileTypeFilter.
  2. The FileTypeFilter of open picker is retained for backward compatibility.
  3. The index property applies to both.

I also renamed the index property to be DefaultFileTypeIndex, as it applies to both FileTypeFilter and FileTypeChoices.
Please let me know your thoughts!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. I think it is confusing to have a single property be the index into two different collections.

I think the best way forward is:

  • Consider 'FileTypeFilter' as the old way of doing things and 'FileTypeChoices' as the new and improved way of doing things.
  • New functionality should target FileTypeChoices.

So, we should have the index be named something like 'DefaultFileTypeChoicesIndex' and it should only apply to FileTypeChoices.

Another question:
What happens if someone sets BOTH of these properties? I assume that is an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kmahone, thanks for the thoughtful feedback!

I’d like to post a perspective on why keeping one single index property (i.e., DefaultFileTypeIndex) is actually the cleaner and more internally consistent design.

FileTypeFilter and FileTypeChoices conceptually control the same UI element. Both APIs populate the same UX surface:

the “File types” dropdown at the bottom-right of the picker dialog.

image image

From the end user’s perspective, that dropdown is a single list.
Whether items come from FileTypeFilter or FileTypeChoices does not change the conceptual model.
So from the app developer’s perspective, the “default index” is simply:

Which entry in that dropdown should be focused initially?

This is one single question, so one index property is a natural representation.

Lastly, answer to the last question:

What happens if someone sets BOTH of these properties? I assume that is an error?

NO, there won't be an error, FileTypeChoices simply takes precedence over the FileTypeFilter. In other words, when they're both specified, only the FileTypeChoices takes effects.

Please find details in Note 3

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following an offline discussion with @kmahone, we’d like to gather additional suggestions from the API review team on this open question:

Should we add separate index properties for FileTypeChoices and FileTypeFilter, or keep the current design?

  • The current design using a single property (DefaultFileTypeIndex) since these three properties interact with the same file type UI element.

  • The alternative way is to add 2 properties:

    • DefaultFileTypeFilterIndex works only for FileTypeFilter and comes to effect when FileTypeFilter comes to effect.
    • DefaultFileTypeChoicesIndex works only for FileTypeChoices and comes to effect when FileTypeChoices comes to effect.


// (Optional) create an empty file when the picked file does not yet exist.
// set to true by default.
CreateNewFileIfNotExists = true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CreateNewFileIfNotExists = true by default means the picker may create files as a side effect of a UI operation?
Combined with ShowOverwritePrompt = false, this could lead to accidental data creation or replacement.

Whether true is the safest default here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Saharsh979 , thanks for raising up this topic!

CreateNewFileIfnotExists = true is already the default behavior of FileSavePicker. This default behavior is consistent with that of the UWP FileSavePicker. Here we're making it customizable so that developers can choose to disable it.

Please note the FileSavePicker should only create a new file when the picked file doesn't exists ( #6023 and #6024 ensured this check ). Therefore, ShowOverwritePrompt doesn't conflict with CreateNewFileIfnotExists in any combination, for the former takes effects when the picked file exists, and the latter works when the picked file doesn't exist.

With the 2 properties, developers will have the flexibility in showing their own warning prompts. Kindly find more details here: #5976

string SettingsIdentifier;

IMap<string, IVector<string>> FileTypeChoices{ get; };
IVector<string> FileTypeFilter{ get; };
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kmahone, thanks for the thoughtful feedback!

I’d like to post a perspective on why keeping one single index property (i.e., DefaultFileTypeIndex) is actually the cleaner and more internally consistent design.

FileTypeFilter and FileTypeChoices conceptually control the same UI element. Both APIs populate the same UX surface:

the “File types” dropdown at the bottom-right of the picker dialog.

image image

From the end user’s perspective, that dropdown is a single list.
Whether items come from FileTypeFilter or FileTypeChoices does not change the conceptual model.
So from the app developer’s perspective, the “default index” is simply:

Which entry in that dropdown should be focused initially?

This is one single question, so one index property is a natural representation.

Lastly, answer to the last question:

What happens if someone sets BOTH of these properties? I assume that is an error?

NO, there won't be an error, FileTypeChoices simply takes precedence over the FileTypeFilter. In other words, when they're both specified, only the FileTypeChoices takes effects.

Please find details in Note 3

selects the `Documents` group.

Additionally, if the index falls outside the available range, we treat it as `-1`, meaning the
picker ignores this setting and follows its built-in default.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kmahone Please find the note of file types related properties here.

string SettingsIdentifier;

IMap<string, IVector<string>> FileTypeChoices{ get; };
IVector<string> FileTypeFilter{ get; };
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following an offline discussion with @kmahone, we’d like to gather additional suggestions from the API review team on this open question:

Should we add separate index properties for FileTypeChoices and FileTypeFilter, or keep the current design?

  • The current design using a single property (DefaultFileTypeIndex) since these three properties interact with the same file type UI element.

  • The alternative way is to add 2 properties:

    • DefaultFileTypeFilterIndex works only for FileTypeFilter and comes to effect when FileTypeFilter comes to effect.
    • DefaultFileTypeChoicesIndex works only for FileTypeChoices and comes to effect when FileTypeChoices comes to effect.


// (Optional) create an empty file when the picked file does not yet exist.
// set to true by default.
CreateNewFileIfNotExists = true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Saharsh979 , thanks for raising up this topic!

CreateNewFileIfnotExists = true is already the default behavior of FileSavePicker. This default behavior is consistent with that of the UWP FileSavePicker. Here we're making it customizable so that developers can choose to disable it.

Please note the FileSavePicker should only create a new file when the picked file doesn't exists ( #6023 and #6024 ensured this check ). Therefore, ShowOverwritePrompt doesn't conflict with CreateNewFileIfnotExists in any combination, for the former takes effects when the picked file exists, and the latter works when the picked file doesn't exist.

With the 2 properties, developers will have the flexibility in showing their own warning prompts. Kindly find more details here: #5976

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-File access Topics related to Microsoft.Windows.Storage.Pickers APIs for selecting files/folders etc. needs-triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants