-api-id | -api-type |
---|---|
T:Windows.Storage.Pickers.FileOpenPicker |
winrt class |
Represents a UI element that lets the user choose and open files.
In a desktop app, before using an instance of this class in a way that displays UI, you'll need to associate the object with its owner's window handle. For more info, and code examples, see Display WinRT UI objects that depend on CoreWindow.
To get started accessing files and folders file picker, see Quickstart: Accessing files with File Pickers.
For information about how to use this API outside of UWP apps, see Call interop APIs from a .NET app.
Windows version | SDK version | Value added |
---|---|---|
1903 | 18362 | CreateForUser |
1903 | 18362 | User |
The File picker sample demonstrates how to check whether the app is snapped, how to set file picker properties, and how to show a file picker so that the user can pick one file.
[!code-csharpall_openpicker_checksnapped_showsingle]
[!code-jsall_openpicker_checksnapped_showsingle]
[!code-csharpcs_checksnapped]
Note
You should always make sure that your app is not snapped (or that it can be unsnapped) and set file picker properties regardless of whether the user is picking a single file or multiple files.
[!code-csharpall_openpicker_showmulti]
[!code-jsall_openpicker_showmulti]
File picker sample, Quickstart: Accessing files with File Pickers, Blobs sample, Display WinRT UI objects that depend on CoreWindow