Skip to content

Commit bb18d58

Browse files
committed
Add notes to UWP docs about wasdk pickers
1 parent c9cb7b3 commit bb18d58

4 files changed

Lines changed: 17 additions & 3 deletions

File tree

windows.storage.pickers/fileopenpicker.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ In a desktop app, before using an instance of this class in a way that displays
1919

2020
To get started accessing files and folders file picker, see [Quickstart: Accessing files with File Pickers](/windows/uwp/files/quickstart-using-file-and-folder-pickers).
2121

22+
> [!NOTE]
23+
> To use a file open picker in a WinUI app (or other desktop app), see the [FileOpenPicker class](/windows/windows-app-sdk/api/winrt/microsoft.windows.storage.pickers.fileopenpicker) documentation for the Windows App SDK.
24+
2225
For information about how to use this API outside of UWP apps, see [Call interop APIs from a .NET app](/windows/apps/desktop/modernize/winrt-com-interop-csharp).
2326

2427
### Version history

windows.storage.pickers/filesavepicker.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,26 @@ In a desktop app, before using an instance of this class in a way that displays
1818
## -remarks
1919

2020
> [!IMPORTANT]
21-
> You must use the [FileTypeChoices property](filesavepicker_filetypechoices.md) property to specify one or more file types before you call the PickSaveFileAsync method, or the picker will thrown an exception.
21+
> You must use the [FileTypeChoices property](filesavepicker_filetypechoices.md) property to specify one or more file types before you call the **PickSaveFileAsync** method, or the picker will thrown an exception.
2222
2323
To learn how to save files through the file picker, see [How to save files through file pickers](/windows/uwp/files/quickstart-save-a-file-with-a-picker).
2424

25+
> [!NOTE]
26+
> To use a file save picker in a WinUI app, see the [FileSavePicker class](/windows/windows-app-sdk/api/winrt/microsoft.windows.storage.pickers.filesavepicker) documentation for the Windows App SDK.
27+
2528
To get started accessing files and folders file picker, see [Files, folders, and libraries ](/windows/uwp/files/index).
2629

2730
> [!WARNING]
2831
> If you try to show the file picker while your app is snapped, the file picker will not be shown and an exception will be thrown. You can avoid this by making sure your app is not snapped or by unsnapping it before you call the file picker. The following code examples and the [File picker sample](https://github.com/microsoft/Windows-universal-samples/tree/master/Samples/FilePicker) show you how.
2932
3033
### In a desktop app that requires elevation
3134

32-
In a desktop app (which includes WinUI 3 apps), you can use **FileSavePicker** (and other types from **Windows.Storage.Pickers**). But if the desktop app requires elevation to run, then you'll need a different approach (that's because these APIs aren't designed to be used in an elevated app). The code snippet below illustrates how you can use the [C#/Win32 P/Invoke Source Generator](https://github.com/microsoft/CsWin32) (CsWin32) to call the Win32 picking APIs instead. To learn how to use CsWin32, follow that link for the documentation.
35+
> [!IMPORTANT]
36+
> The file and folder picker APIs (Windows.Storage.Pickers) in the Windows SDK don't work when apps run as administrator (elevated mode). To address this gap, the [Microsoft.Windows.Storage.Pickers](/windows/windows-app-sdk/api/winrt/microsoft.windows.storage.pickers) APIs are added to the Windows App SDK and support file and folder selection in elevated mode. It's designed for desktop apps and uses a WindowId property to link the picker to its host window.
37+
>
38+
> If you must use the Windows.Storage.Pickers APIs in an elevated desktop app, you can follow example below.
39+
40+
You can use **FileSavePicker** (and other types from **Windows.Storage.Pickers**) in a desktop app. However, if the desktop app requires elevation to run, then you'll need a different approach (that's because these APIs aren't designed to be used in an elevated app). The code snippet below illustrates how you can use the [C#/Win32 P/Invoke Source Generator](https://github.com/microsoft/CsWin32) (CsWin32) to call the Win32 picking APIs instead. To learn how to use CsWin32, follow that link for the documentation.
3341

3442
```csharp
3543
// NativeMethods.txt

windows.storage.pickers/folderpicker.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ In a desktop app, before using an instance of this class in a way that displays
2020

2121
To get started accessing files and folders with a picker, see [Open files and folders with a picker](/windows/uwp/files/quickstart-using-file-and-folder-pickers).
2222

23+
> [!NOTE]
24+
> To use a folder picker in a WinUI app (or other desktop app), see the [FolderPicker class](/windows/windows-app-sdk/api/winrt/microsoft.windows.storage.pickers.folderpicker) documentation for the Windows App SDK.
25+
2326
### Version history
2427

2528
| Windows version | SDK version | Value added |

windows.storage.pickers/windows_storage_pickers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
## -description
99

10-
Provides classes for creating and managing user interface (UI) elements that let the user browse files, choose files to open, and to choose the name, extension, and location when storing files.
10+
The **Windows.Storage.Pickers** namespace contains classes that create file and folder picker dialogs. Use these classes to let users browse, select files to open, and choose where to save files with specific names and extensions.
1111

1212
## -remarks
1313

0 commit comments

Comments
 (0)