-
Notifications
You must be signed in to change notification settings - Fork 390
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
Changes from all commits
c8a9de9
78492ba
3bb52bf
59848a6
f46f3f7
5c7f72e
01bcb15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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. | ||
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 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. |
||
|
||
- `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. |
Uh oh!
There was an error while loading. Please reload this page.