FolderPicker FolderPicker FolderPicker FolderPicker Class

Represents a UI element that lets the user choose folders.

Syntax

Declaration

public sealed class FolderPickerpublic sealed class FolderPickerPublic NotInheritable Class FolderPicker

Remarks

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

Constructors summary

Creates a new instance of a FolderPicker.

Properties summary

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

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 Store app)

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

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

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

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

Methods summary

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 Store app)

Shows the FolderPicker object so that the user can pick a folder. (Windows Store 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.

Constructors

  • FolderPicker()
    FolderPicker()
    FolderPicker()
    FolderPicker()

    Creates a new instance of a FolderPicker.

    public FolderPicker()public FolderPicker()Public Function FolderPicker() As

Properties

  • CommitButtonText
    CommitButtonText
    CommitButtonText
    CommitButtonText

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

    public string CommitButtonText { get; set; }public string CommitButtonText { get; set; }Public ReadWrite Property CommitButtonText As string

    Property Value

    • 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 Store app)

    public ValueSet ContinuationData { get; }public ValueSet ContinuationData { get; }Public ReadOnly Property ContinuationData As ValueSet

    Property Value

    Remarks

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

  • FileTypeFilter
    FileTypeFilter
    FileTypeFilter
    FileTypeFilter

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

    public IVector<string> FileTypeFilter { get; }public IVector<string> FileTypeFilter { get; }Public ReadOnly Property FileTypeFilter As IVector<string>

    Property Value

    • 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.

    Remarks

    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(["*"]);
    
  • SettingsIdentifier
    SettingsIdentifier
    SettingsIdentifier
    SettingsIdentifier

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

    public string SettingsIdentifier { get; set; }public string SettingsIdentifier { get; set; }Public ReadWrite Property SettingsIdentifier As string

    Property Value

    • 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

    Property Value

    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

    Property Value

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 Store app)

    public void PickFolderAndContinue()public void PickFolderAndContinue()Public Function PickFolderAndContinue() As void

    Remarks

    Windows Phone Store 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.

  • PickSingleFolderAsync()
    PickSingleFolderAsync()
    PickSingleFolderAsync()
    PickSingleFolderAsync()

    Shows the FolderPicker object so that the user can pick a folder. (Windows Store 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 )

    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.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.ActivatableAttribute

Details

Assembly

Windows.Storage.Pickers.dll