Represents a UI element that lets the user choose folders.
Syntax
Public NotInheritable Class FolderPicker Inherits Object
Attributes
- ActivatableAttribute(NTDDI_WIN8)
- VersionAttribute(NTDDI_WIN8)
Members
The FolderPicker class has these types of members:
Constructors
The FolderPicker class has these constructors.
| Constructor | Description |
|---|---|
| FolderPicker | Creates a new instance of a FolderPicker. |
Methods
The FolderPicker class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.
| Method | Description |
|---|---|
| PickSingleFolderAsync | Shows the folderPicker object so that the user can pick a folder. |
Properties
The FolderPicker class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read/write | Gets or sets the label text of the folder picker's commit button. | |
| Read-only | Gets the collection of file types that the folder picker displays. | |
| Read/write | Gets or sets the settings identifier associated with the with the current FolderPicker instance. | |
| Read/write | Gets or sets the initial location where the folder picker looks for folders to present to the user. | |
| Read/write | Gets or sets the view mode that the folder picker uses to display items. |
Remarks
To get started accessing files and folders file pickers, see Quickstart: Accessing files with file pickers.
Warning 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 show you how.
Examples
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 a folder for the app to access.
For C#, the File picker sample demonstrates how to check whether your app is snapped in the EnsureUnsnapped method.
internal bool EnsureUnsnapped() { // FilePicker APIs will not work if the application is in a snapped state. // If an app wants to show a FilePicker while snapped, it must attempt to unsnap first bool unsnapped = ((ApplicationView.Value != ApplicationViewState.Snapped) || ApplicationView.TryUnsnap()); if (!unsnapped) { NotifyUser("Cannot unsnap the sample.", NotifyType.StatusMessage); } return unsnapped; }
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 2/25/2013