-
Notifications
You must be signed in to change notification settings - Fork 428
API review for new properties in Storage.Pickers - SuggestedDefaultFolder, FileTypeChoices #5771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c8a9de9
SetDefaultFolder; FileOpenPicker.FileTypeChoices
DinahK-2SO 78492ba
SuggestedStartFolder
DinahK-2SO 3bb52bf
fix errors; add more details
DinahK-2SO 59848a6
add special notes for the pickers
DinahK-2SO f46f3f7
fix errors, add missing urls
DinahK-2SO 5c7f72e
Add SuggestedFolder for FileOpenPicker and FolderPicker
DinahK-2SO 01bcb15
update API definations
DinahK-2SO File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,8 @@ in elevated scenarios.* | |
| 1. *Similarly, the `FileSavePicker.SuggestedSaveFile` property (which returned a `StorageFile`) | ||
| has been replaced. Its functionality is now covered by two string properties: `SuggestedFolder` and | ||
| `SuggestedFileName`. These allow for suggesting the folder and file name for the save dialog.* | ||
| 1. Also adding the `SuggestedFolder` property to `FileOpenPicker` and `FolderPicker`, to better | ||
| support a commonly requested scenario - setting a persistent folder for all pickers. | ||
| 1. *All new pickers are designed specifically for desktop apps and use a `WindowId` property to | ||
| link the picker to its host window, replacing the `WinRT.Interop.InitializeWithWindow.Initialize` | ||
| pattern.* | ||
|
|
@@ -46,6 +48,15 @@ because the new APIs are currently designed for desktop scenarios where each use | |
| interactive session, and each session is completely independent of the other sessions on the device. | ||
| This is in contrast to Xbox One or other multi-user devices.* | ||
|
|
||
| 1. Adding `SuggestedStartFolder` for all 3 pickers. This allows setting the initial folder with | ||
| an absolute folder path in string. When its specified folder exists, `SuggestedStartFolder` | ||
| takes precedence over `SuggestedStartLocation`; when its folder not found, the picker falls back | ||
| to `SuggestedStartLocation`, then to the system default. | ||
|
|
||
| 1. Adding `FileTypeChoices` for `FileOpenPicker`. This allows the dialog of FileOpenPicker to have | ||
| catagorized filter types. When both `FileTypeChoices` and `FileTypeFilter` are provided, | ||
| `FileTypeChoices` is used and `FileTypeFilter` is ignored. | ||
|
|
||
| # Conceptual pages | ||
|
|
||
| # API | ||
|
|
@@ -108,8 +119,14 @@ namespace Microsoft.Windows.Storage.Pickers | |
| FileOpenPicker(Microsoft.UI.WindowId windowId); | ||
|
|
||
| string CommitButtonText; | ||
|
|
||
| IMap<string, IVector<string>> FileTypeChoices{ get; }; | ||
| IVector<string> FileTypeFilter{ get; }; | ||
|
|
||
| string SuggestedFolder; | ||
| string SuggestedStartFolder; | ||
| PickerLocationId SuggestedStartLocation; | ||
|
|
||
| PickerViewMode ViewMode; | ||
|
|
||
| Windows.Foundation.IAsyncOperation<PickFileResult> PickSingleFileAsync(); | ||
|
|
@@ -123,10 +140,11 @@ namespace Microsoft.Windows.Storage.Pickers | |
| string CommitButtonText; | ||
| string DefaultFileExtension; | ||
| string SuggestedFileName; | ||
| string SuggestedFolder; | ||
|
|
||
| IMap<string, IVector<string>> FileTypeChoices{ get; }; | ||
|
|
||
| string SuggestedFolder; | ||
| string SuggestedStartFolder; | ||
| PickerLocationId SuggestedStartLocation; | ||
|
|
||
| Windows.Foundation.IAsyncOperation<PickFileResult> PickSaveFileAsync(); | ||
|
|
@@ -138,10 +156,34 @@ namespace Microsoft.Windows.Storage.Pickers | |
|
|
||
| string CommitButtonText; | ||
|
|
||
| string SuggestedFolder; | ||
| string SuggestedStartFolder; | ||
| PickerLocationId SuggestedStartLocation; | ||
|
|
||
| PickerViewMode ViewMode; | ||
|
|
||
| Windows.Foundation.IAsyncOperation<PickFolderResult> PickSingleFolderAsync(); | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Note: **Understanding SuggestedStartFolder/SuggestedStartLocation vs SuggestedFolder:** | ||
|
|
||
| These two kinds of properties have fundamentally different behaviors in terms of when and how they | ||
| affect the picker: | ||
|
|
||
| - `SuggestedFolder` sets the path that will always be tried when opening the picker, regardless of | ||
| the user's previous operations. This uses the [SetFolder](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setfolder) | ||
| method of the underlying COM APIs and takes precedence over any user navigation history. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was discussed before, but I'm forgetting the details. If the |
||
|
|
||
| - `SuggestedStartFolder` sets the path shown only the first time the user launches the picker | ||
| (typically when the app is newly installed). After the user has picked a file, subsequent | ||
| launches of the picker will open to the user's last selected folder, and `SuggestedStartFolder` | ||
| becomes silent. This corresponds to the [SetDefaultFolder](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialog-setdefaultfolder) | ||
| method in the COM API. | ||
|
|
||
| The effective time span of `SuggestedStartFolder` is the same as that of `SuggestedStartLocation`, | ||
| both only influence the picker's initial behavior before user interaction establishes a | ||
| navigation history. | ||
|
|
||
| `SuggestedStartFolder` takes precedence over `SuggestedStartLocation` when both specified. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.