FolderPicker FolderPicker FolderPicker FolderPicker Class

Definition

Represents a UI element that lets the user choose folders.

public : sealed class FolderPicker : IFolderPicker, IFolderPicker2
public sealed class FolderPicker : IFolderPicker, IFolderPicker2
Public NotInheritable Class FolderPicker Implements IFolderPicker, IFolderPicker2
var folderPicker = new folderPicker();
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

To get started accessing files and folders file picker, see Open files and folders with a picker.

Constructors

FolderPicker() FolderPicker() FolderPicker() FolderPicker()

Creates a new instance of a FolderPicker.

public : FolderPicker()
public FolderPicker()
Public Sub New()
var folderPicker = new folderPicker();

Properties

CommitButtonText CommitButtonText CommitButtonText CommitButtonText

Gets or sets the label text of the folder picker's commit button.

public : Platform::String CommitButtonText { get; set; }
public string CommitButtonText { get; set; }
Public ReadWrite Property CommitButtonText As string
var string = folderPicker.commitButtonText;
folderPicker.commitButtonText = string;
Value
Platform::String string string string

The label text.

Remarks

By default, the label text of the commit button is Pick Folder.

ContinuationData ContinuationData ContinuationData ContinuationData

Gets a set of values to be populated by the app before a PickFolderAndContinue operation that deactivates the app in order to provide context when the app is activated. (Windows Phone 8.x app)

public : ValueSet ContinuationData { get; }
public ValueSet ContinuationData { get; }
Public ReadOnly Property ContinuationData As ValueSet
var valueSet = folderPicker.continuationData;
Value
ValueSet ValueSet ValueSet ValueSet

A set of values to be populated by the app before a PickFolderAndContinue operation that deactivates the app in order to provide context when the app is activated.

Remarks

Windows Phone 8.x app only. For more info, see How to continue your Windows Phone app after calling a file picker.

See Also

FileTypeFilter FileTypeFilter FileTypeFilter FileTypeFilter

Gets the collection of file types that the folder picker displays.

public : IVector<Platform::String> FileTypeFilter { get; }
public IList<string> FileTypeFilter { get; }
Public ReadOnly Property FileTypeFilter As IList<string>
var iList = folderPicker.fileTypeFilter;
Value
IVector<Platform::String> IList<string> IList<string> IList<string>

A FileExtensionVector object that contains a collection of file types (file name extensions) , such as ".doc" and ".png". File name extensions are stored in this array as string objects.

Examples

The File picker sample demonstrates how to show files of any type in the file picker.

FolderPicker folderPicker = new FolderPicker();
folderPicker.SuggestedStartLocation = PickerLocationId.Desktop;
folderPicker.FileTypeFilter.Add("*");
var folderPicker = new Windows.Storage.Pickers.FolderPicker();
folderPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.desktop;
folderPicker.fileTypeFilter.replaceAll(["*"]);
See Also

SettingsIdentifier SettingsIdentifier SettingsIdentifier SettingsIdentifier

Gets or sets the settings identifier associated with the with the current FolderPicker instance.

public : Platform::String SettingsIdentifier { get; set; }
public string SettingsIdentifier { get; set; }
Public ReadWrite Property SettingsIdentifier As string
var string = folderPicker.settingsIdentifier;
folderPicker.settingsIdentifier = string;
Value
Platform::String string string string

The settings identifier.

Remarks

If your application uses multiple instances of the folder picker, you can use this property to identify the individual instances.

SuggestedStartLocation SuggestedStartLocation SuggestedStartLocation SuggestedStartLocation

Gets or sets the initial location where the folder picker looks for folders to present to the user.

public : PickerLocationId SuggestedStartLocation { get; set; }
public PickerLocationId SuggestedStartLocation { get; set; }
Public ReadWrite Property SuggestedStartLocation As PickerLocationId
var pickerLocationId = folderPicker.suggestedStartLocation;
folderPicker.suggestedStartLocation = pickerLocationId;
Value
PickerLocationId PickerLocationId PickerLocationId PickerLocationId

The identifier of the starting location.

Remarks

The SuggestedStartLocation is not always used as the start location for the file picker. To give the user a sense of consistency, the file picker remembers the last location that the user navigated to and will generally start at that location.

ViewMode ViewMode ViewMode ViewMode

Gets or sets the view mode that the folder picker uses to display items.

public : PickerViewMode ViewMode { get; set; }
public PickerViewMode ViewMode { get; set; }
Public ReadWrite Property ViewMode As PickerViewMode
var pickerViewMode = folderPicker.viewMode;
folderPicker.viewMode = pickerViewMode;

Methods

PickFolderAndContinue() PickFolderAndContinue() PickFolderAndContinue() PickFolderAndContinue()

Shows the file picker so that the user can pick a folder, deactivating and the app and reactivating it when the operation is complete. (Windows Phone 8.x app)

public : void PickFolderAndContinue()
public void PickFolderAndContinue()
Public Function PickFolderAndContinue() As void
folderPicker.pickFolderAndContinue();

Remarks

Windows Phone 8.x app only. Use the ContinuationData property to store context information that can be retrieved when the app is reactivated. For more info, see How to continue your Windows Phone app after calling a file picker.

See Also

PickSingleFolderAsync() PickSingleFolderAsync() PickSingleFolderAsync() PickSingleFolderAsync()

Shows the folderPicker object so that the user can pick a folder. (UWP app)

Note

You must specify the FileTypeFilter before calling this method, or it will throw an exception. To list all folders, use "*" as the filter.

public : IAsyncOperation<StorageFolder> PickSingleFolderAsync()
public IAsyncOperation<StorageFolder> PickSingleFolderAsync()
Public Function PickSingleFolderAsync() As IAsyncOperation( Of StorageFolder )
var iAsyncOperation = folderPicker.pickSingleFolderAsync();
Returns

When the call to this method completes successfully, it returns a storageFolder object that represents the folder that the user picked.

Remarks

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 FolderPicker code examples and the File picker sample show you how.

See Also