Skip to content

Commit 73a70d3

Browse files
committed
Resolve comments; Fix typos and grammer errors in doc.
1 parent 62ea719 commit 73a70d3

16 files changed

+121
-1242
lines changed

specs/Storage.Pickers/FileOpenPicker.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,19 @@ using Microsoft.Windows.Storage.Pickers;
3838

3939
var openPicker = new FileOpenPicker(this.AppWindow.Id)
4040
{
41-
// (Optional) specify the initial location.
42-
// If not specified, default to PickerLocationId.Unspecified.
41+
// (Optional) Specify the initial location for the picker.
42+
// If the specified location doesn't exist on the user's machine, it falls back to the DocumentsLibrary.
43+
// If not set, it defaults to PickerLocationId.Unspecified, and the system will use its default location.
4344
SuggestedStartLocation = PickerLocationId.DocumentsLibrary,
4445

45-
// (Optional) specify the text displayed on commit button.
46+
// (Optional) specify the text displayed on the commit button.
4647
// If not specified, the system uses a default label of "Open" (suitably translated).
4748
CommitButtonText = "Choose selected files",
4849

49-
// (Optional) specify file extensions filters. If not specified, default to all (*.*)
50+
// (Optional) specify file extension filters. If not specified, defaults to all files (*.*).
5051
FileTypeFilter = { ".txt", ".pdf", ".doc", ".docx" },
5152

52-
// (Optional) specify the view mode of the picker dialog. If not specified, default to List.
53+
// (Optional) specify the view mode of the picker dialog. If not specified, defaults to List.
5354
ViewMode = PickerViewMode.List,
5455
};
5556
```
@@ -62,28 +63,29 @@ using namespace winrt::Microsoft::Windows::Storage::Pickers;
6263

6364
FileOpenPicker openPicker(AppWindow().Id());
6465

65-
// (Optional) specify the initial location.
66-
// If not specified, default to PickerLocationId.Unspecified.
66+
// (Optional) Specify the initial location for the picker.
67+
// If the specified location doesn't exist on the user's machine, it falls back to the DocumentsLibrary.
68+
// If not set, it defaults to PickerLocationId.Unspecified, and the system will use its default location.
6769
openPicker.SuggestedStartLocation(PickerLocationId::DocumentsLibrary);
6870

69-
// (Optional) specify the text displayed on commit button.
71+
// (Optional) specify the text displayed on the commit button.
7072
// If not specified, the system uses a default label of "Open" (suitably translated).
7173
openPicker.CommitButtonText(L"Choose selected files");
7274

73-
// (Optional) specify file extensions filters. If not specified, default to all (*.*)
75+
// (Optional) specify file extension filters. If not specified, defaults to all files (*.*).
7476
openPicker.FileTypeFilter().ReplaceAll({ L".txt", L".pdf", L".doc", L".docx" });
7577

76-
// (Optional) specify the view mode of the picker dialog. If not specified, default to List.
77-
picker.ViewMode(PickerViewMode::List);
78+
// (Optional) specify the view mode of the picker dialog. If not specified, defaults to List.
79+
openPicker.ViewMode(PickerViewMode::List);
7880
```
7981
8082
## FileOpenPicker.PickSingleFileAsync
8183
82-
Displays a UI element that allows user to choose and open one file.
84+
Displays a UI element that allows the user to choose and open one file.
8385
84-
Returns a light weight object that has the path of the picked file.
86+
Returns a lightweight object that has the path of the picked file.
8587
86-
Return null if the file dialog was cancelled or closed without selection.
88+
Returns `null` if the file dialog was cancelled or closed without a selection.
8789
8890
### Examples
8991
@@ -128,11 +130,11 @@ else
128130

129131
## FileOpenPicker.PickMultipleFilesAsync
130132

131-
Displays a UI element that allows user to choose and open multiple files.
133+
Displays a UI element that allows the user to choose and open multiple files.
132134

133-
Returns a collection of light weight objects that has the path of picked files.
135+
Returns a collection of lightweight objects that have the path of the picked files.
134136

135-
Return an empty list (Count = 0) if the file dialog's cancelled or closed without selection.
137+
Returns an empty list (`Count` = 0) if the file dialog was cancelled or closed without a selection.
136138

137139
### Examples
138140

specs/Storage.Pickers/FileSavePicker.md

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,26 @@ using Microsoft.Windows.Storage.Pickers;
3939

4040
var savePicker = new FileSavePicker(this.AppWindow.Id)
4141
{
42-
// (Optional) specify the initial location.
43-
// If not specified, default to PickerLocationId.Unspecified.
42+
// (Optional) Specify the initial location for the picker.
43+
// If the specified location doesn't exist on the user's machine, it falls back to the DocumentsLibrary.
44+
// If not set, it defaults to PickerLocationId.Unspecified, and the system will use its default location.
4445
SuggestedStartLocation = PickerLocationId.DocumentsLibrary,
4546

4647
// (Optional) specify the default file name. If not specified, use system default.
4748
SuggestedFileName = "My Document",
4849

49-
// (Optional) specify the text displayed on commit button.
50-
// If not specified, the system uses a default label of "Open" (suitably translated).
50+
// (Optional) specify the text displayed on the commit button.
51+
// If not specified, the system uses a default label of "Save" (suitably translated).
5152
CommitButtonText = "Save Document",
5253

53-
// (Optional) categorized extensions types. If not specified, allow All Files (*.*)
54-
// Note that when allow All Files (*.*), end users can save a file without extension.
54+
// (Optional) categorized extension types. If not specified, "All Files (*.*)" is allowed.
55+
// Note that when "All Files (*.*)" is allowed, end users can save a file without an extension.
5556
FileTypeChoices = {
5657
{ "Documents", new List<string> { ".txt", ".doc", ".docx" } }
5758
},
5859

59-
// (Optional) specify the default file extension (will be appended after the default file name).
60-
// If not specified, will not appended after the default extension.
60+
// (Optional) specify the default file extension (will be appended to SuggestedFileName).
61+
// If not specified, no extension will be appended.
6162
DefaultFileExtension = ".txt",
6263
};
6364
```
@@ -70,37 +71,38 @@ using namespace winrt::Microsoft::Windows::Storage::Pickers;
7071

7172
FileSavePicker savePicker(AppWindow().Id());
7273

73-
// (Optional) specify the initial location.
74-
// If not specified, default to PickerLocationId.Unspecified.
74+
// (Optional) Specify the initial location for the picker.
75+
// If the specified location doesn't exist on the user's machine, it falls back to the DocumentsLibrary.
76+
// If not set, it defaults to PickerLocationId.Unspecified, and the system will use its default location.
7577
savePicker.SuggestedStartLocation(PickerLocationId::DocumentsLibrary);
7678

7779
// (Optional) specify the default file name. If not specified, use system default.
7880
savePicker.SuggestedFileName(L"NewDocument");
7981

80-
// (Optional) specify the text displayed on commit button.
81-
// If not specified, the system uses a default label of "Open" (suitably translated).
82+
// (Optional) specify the text displayed on the commit button.
83+
// If not specified, the system uses a default label of "Save" (suitably translated).
8284
savePicker.CommitButtonText(L"Save Document");
8385

84-
// (Optional) categorized extensions types. If not specified, allow All Files (*.*)
85-
// Note that when allow All Files (*.*), end users can save a file without extension.
86+
// (Optional) categorized extension types. If not specified, "All Files (*.*)" is allowed.
87+
// Note that when "All Files (*.*)" is allowed, end users can save a file without an extension.
8688
savePicker.FileTypeChoices().Insert(L"Text", winrt::single_threaded_vector<winrt::hstring>({ L".txt" }));
8789

88-
// (Optional) specify the default file extension (will be appended after the default file name).
89-
// If not specified, will not appended after the default extension.
90+
// (Optional) specify the default file extension (will be appended to SuggestedFileName).
91+
// If not specified, no extension will be appended.
9092
savePicker.DefaultFileExtension(L".txt");
9193
```
9294
9395
## Setting the FileSavePicker.SuggestedSaveFilePath Property
9496
95-
The `SuggestedSaveFilePath` property of `FileSavePicker` dictates 2 key aspects of the save file
97+
The `SuggestedSaveFilePath` property of `FileSavePicker` dictates two key aspects of the save file
9698
dialog's initial state:
9799
98100
* **Initial Directory:** The dialog defaults to the directory of the `SuggestedSaveFilePath`.
99101
100102
This behavior overrides any picker-specific remembered folder settings and ensures the dialog
101103
opens in the suggested file's parent folder.
102104
103-
* **Pre-filled File Name:** The file name field in the dialog is pre-populated with the name of
105+
* **Pre-filled File Name:** The file name field in the dialog is pre-populated with the name from
104106
the `SuggestedSaveFilePath`.
105107
106108
This file name overrides the `FileSavePicker.SuggestedFileName` property if both are set.
@@ -111,7 +113,7 @@ C#
111113
using Microsoft.Windows.Storage.Pickers;
112114
113115
var savePicker = new FileSavePicker(this.AppWindow.Id);
114-
savePicker.SuggestedSaveFilePath(@"C:\temp\MyProject\MyFile.txt");
116+
savePicker.SuggestedSaveFilePath = @"C:\temp\MyProject\MyFile.txt";
115117
```
116118

117119
C++
@@ -120,34 +122,42 @@ C++
120122
using namespace winrt::Microsoft::Windows::Storage::Pickers;
121123

122124
FileSavePicker savePicker(AppWindow().Id());
123-
bool isSuccess = savePicker.SuggestedSaveFilePath(L"C:\\temp\\MyProject\\MyFile.txt");
125+
savePicker.SuggestedSaveFilePath(L"C:\\temp\\MyProject\\MyFile.txt");
124126
```
125127
126-
### The Parsing Logic of Setting SuggestedSaveFilePath
128+
### The Parsing Logic
127129
128-
`SuggestedSaveFilePath` takes whatever after **the last slash** to fill in the file name box,
129-
as long as the part before the last slash is a valid and existing folder.
130+
The `SuggestedSaveFilePath` property is parsed to set the directory and file name in the
131+
save dialog.
130132
131-
It allows the value to be set to an empty string. However, it raises invalid argument exception
132-
if the non-empty input doesn't contain have a folder path.
133+
- The substring before the final path separator (`\`) is used as the initial directory.
134+
This part must be written in the format of a folder path.
135+
- The substring after the final path separator is used as the suggested file name.
136+
- If `SuggestedSaveFilePath` is set to an empty string, the property is cleared and will not take
137+
effect when launching the save dialog.
138+
- If the provided path is a non-empty string but it does not have a folder path
139+
(e.g., `"MyFile.txt"`), an `InvalidArgumentException` will be thrown.
133140
134-
Here're some examples about the parsing logic:
141+
The following table illustrates the parsing behavior:
142+
143+
| `SuggestedSaveFilePath` Input | Resulting Initial Directory | Resulting File Name |
144+
|-------------------------------|-----------------------------|---------------------|
145+
| `'C:\temp\MyProject\MyFile.txt'` | `'C:\temp\MyProject'` | `'MyFile.txt'` |
146+
| `'C:\temp\MyProject\.git\'` | `'C:\temp\MyProject\.git'` | `''` (empty) |
147+
| `'C:\temp\MyProject\.git'` | `'C:\temp\MyProject'` | `'.git'` |
148+
| `'C:\servers\www.bing.com\'` | `'C:\servers\www.bing.com'` | `''` (empty) |
149+
| `'C:\servers\www.bing.com'` | `'C:\servers'` | `'www.bing.com'` |
150+
| `''` (empty string) | null |
151+
| `'MyFile.txt'` | Throws `InvalidArgumentException` | Throws `InvalidArgumentException` |
135152
136-
|Input path string | Set folder | Set file name |
137-
|------------------|------------|---------------|
138-
|`'C:\temp\MyProject\MyFile.txt'`|`'C:\temp\MyProject'`| `'MyFile.txt'`|
139-
|`'C:\temp\MyProject\.git\'`|`'C:\temp\MyProject\.git'`| `''`|
140-
|`'C:\temp\MyProject\.git'`|`'C:\temp\MyProject'`| `'.git'`|
141-
|`'C:\servers\www.bing.com\'`|`'C:\servers\www.bing.com'`| `''`|
142-
|`'C:\servers\www.bing.com'`|`'C:\servers`| `'www.bing.com'`|
143153
144154
## FileSavePicker.PickSaveFileAsync
145155
146156
Displays a UI element that allows the user to configure the file path to save.
147157
148-
Returns a light weight object that has the path of the saved file.
158+
Returns a lightweight object that has the path of the saved file.
149159
150-
Returns null if the file dialog was cancelled or closed without saved file.
160+
Returns `null` if the file dialog was cancelled or closed without saving a file.
151161
152162
### Examples
153163

specs/Storage.Pickers/FolderPicker.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ using Microsoft.Windows.Storage.Pickers;
4242

4343
var folderPicker = new FolderPicker(this.AppWindow.Id)
4444
{
45-
// (Optional) specify the initial location.
46-
// If not specified, default to PickerLocationId.Unspecified.
45+
// (Optional) Specify the initial location for the picker.
46+
// If the specified location doesn't exist on the user's machine, it falls back to the DocumentsLibrary.
47+
// If not set, it defaults to PickerLocationId.Unspecified, and the system will use its default location.
4748
SuggestedStartLocation = PickerLocationId.DocumentsLibrary,
4849

49-
// (Optional) specify the text displayed on commit button.
50+
// (Optional) specify the text displayed on the commit button.
5051
// If not specified, the system uses a default label of "Open" (suitably translated).
5152
CommitButtonText = "Select Folder",
5253

@@ -63,11 +64,12 @@ using namespace winrt::Microsoft::Windows::Storage::Pickers;
6364

6465
FolderPicker folderPicker(AppWindow().Id());
6566

66-
// (Optional) specify the initial location.
67-
// If not specified, default to PickerLocationId.Unspecified.
67+
// (Optional) Specify the initial location for the picker.
68+
// If the specified location doesn't exist on the user's machine, it falls back to the DocumentsLibrary.
69+
// If not set, it defaults to PickerLocationId.Unspecified, and the system will use its default location.
6870
folderPicker.SuggestedStartLocation(PickerLocationId::DocumentsLibrary);
6971

70-
// (Optional) specify the text displayed on commit button.
72+
// (Optional) specify the text displayed on the commit button.
7173
// If not specified, the system uses a default label of "Open" (suitably translated).
7274
folderPicker.CommitButtonText(L"Select Folder");
7375

@@ -79,9 +81,9 @@ folderPicker.ViewMode(PickerViewMode::List);
7981
8082
Displays a UI element that allows the user to choose a folder.
8183
82-
Returns a light weight object that has the path of the picked folder.
84+
Returns a lightweight object that has the path of the picked folder.
8385
84-
Returns null if the file dialog was cancelled or closed without selection.
86+
Returns `null` if the file dialog was cancelled or closed without a selection.
8587
8688
### Examples
8789

specs/Storage.Pickers/Microsoft.Windows.Storage.Pickers.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,42 @@ design, but with key improvements for desktop scenarios.
88

99
# Background
1010

11-
The new `Microsoft.Windows.Storage.Pickers` API addresses three critical limitations of the UWP file
11+
The new `Microsoft.Windows.Storage.Pickers` API addresses two critical limitations of the UWP file
1212
and folder pickers on Apps developed with WinAppSDK/WinUI 3:
1313

1414
1. **Elevated Process Support**: The existing [Windows.Storage.Pickers](https://learn.microsoft.com/en-us/uwp/api/windows.storage.pickers)
15-
APIs do not work when running as an administrator. The new API enables file and folder selection in
16-
elevated mode.
15+
APIs do not work when the application is running as an administrator. The new API enables file and
16+
folder selection in elevated mode.
1717

1818
2. **Simplified Usage in WinUI 3**: Using the existing UWP pickers in WinUI 3 requires initializing
19-
window handle for window association. The new pickers eliminate this requirement by accepting a
19+
a window handle for window association. The new pickers eliminate this requirement by accepting a
2020
`WindowId` directly in the constructor, making them easier to use.
2121

2222
# Key Differences
23-
*Spec Note: Here are some key differences from the UWP Windows.Storage.Pickers:*
24-
1. *Unlike the existing `Windows.Storage.Pickers` API which returns `StorageFile/StorageFolder`
23+
*Spec Note: Here are some key differences from the UWP `Windows.Storage.Pickers`:*
24+
1. *Unlike the existing `Windows.Storage.Pickers` API which returns `StorageFile`/`StorageFolder`
2525
objects, this new API returns string-based paths through `PickFileResult` and `PickFolderResult`
2626
classes. This design choice simplifies the API and avoids complications with storage capabilities
2727
in elevated scenarios.*
28-
1. *Similarly, the `StorageFile` type property `FileSavePicker.SuggestedSaveFile` is also replaced
29-
by a string type `FileSavePicker.SuggestedSaveFilePath`.*
30-
1. *All new pickers are designed specifically for desktop apps and uses a `WindowId` property to
28+
1. *Similarly, the `StorageFile` type property `FileSavePicker.SuggestedSaveFile` is replaced
29+
by a string type property `FileSavePicker.SuggestedSaveFilePath`.*
30+
1. *All new pickers are designed specifically for desktop apps and use a `WindowId` property to
3131
link the picker to its host window, replacing the `WinRT.Interop.InitializeWithWindow.Initialize`
3232
pattern.*
33-
1. The new pickers allow developers to use pickers without requiring `FileTypeFilter` or
33+
1. The new pickers allow developers to use them without requiring `FileTypeFilter` or
3434
`FileTypeChoices` to be specified. While UWP pickers throw exceptions when these properties are not
35-
set, the new pickers default to show all file when developers don't explicitly configure these
35+
set, the new pickers default to showing all files when developers do not explicitly configure these
3636
properties.
37-
1. *HomeGroup location has been excluded from the new `PickerLocationId` enum as it's no longer
38-
supported in Windows 10 and later*
39-
1. *FolderPicker.FileTypeFilter has been exluded as it was not functionally appropriate for folder
40-
selection*
41-
1. *Excluding methods and properties that are already marked as deprecated, or "Do not use".
42-
e.g. `PickSingleFileAndContinue`, `ContinuationData`, `ResumePickSingleFileAsync`, etc*
37+
1. *The `HomeGroup` location has been excluded from the new `PickerLocationId` enum as it is
38+
no longer supported in Windows 10 and later.*
39+
1. *`FolderPicker.FileTypeFilter` has been excluded as it was not functionally appropriate for folder
40+
selection.*
41+
1. *Excluding methods and properties that are already marked as deprecated or "Do not use".
42+
e.g., `PickSingleFileAndContinue`, `ContinuationData`, `ResumePickSingleFileAsync`, etc.*
4343
1. *Excluding methods and properties for [multi-user-mode](https://learn.microsoft.com/en-us/previous-versions/windows/uwp/xbox-apps/multi-user-applications),
44-
as the new APIs are currently designed for desktop scenarios where each user has their own
45-
interactive session and each session is completely independent of the other sessions on the device,
46-
instead of Xbox One or other multi-user devices.*
44+
because the new APIs are currently designed for desktop scenarios where each user has their own
45+
interactive session, and each session is completely independent of the other sessions on the device.
46+
This is in contrast to Xbox One or other multi-user devices.*
4747

4848
# Conceptual pages
4949

@@ -52,7 +52,7 @@ instead of Xbox One or other multi-user devices.*
5252
## Classes
5353

5454
Note: Developers should specify a window id to associate the picker with an owner window before
55-
showing UI.
55+
showing the UI.
5656

5757
| **Class** | **Description** |
5858
|------------------|-----------------|
@@ -67,7 +67,7 @@ showing UI.
6767
| **Enum** | **Description** |
6868
|----------|-----------------|
6969
|[PickerLocationId](PickerLocationId.md)| Identifies the storage location that the file picker presents to the user. |
70-
|[PickerViewMode](PickerViewMode.md) | Indicates the view mode that the file picker is using to present items. |
70+
|[PickerViewMode](PickerViewMode.md) | Indicates the view mode that the file picker uses to present items. |
7171

7272
## Definition
7373

0 commit comments

Comments
 (0)