FileOpenPickerUI class

Applies to Windows and Windows Phone

Used to interact with the file picker if your app provides files with the File Open Picker contract.

Syntax


var fileOpenPickerUI = fileOpenPickerActivatedEventArgs.fileOpenPickerUI;

Attributes

[Version(0x06020000)]

Members

The FileOpenPickerUI class has these types of members:

Events

The FileOpenPickerUI class has these events.

EventDescription
Closing Fires when the user closes the file picker
FileRemoved Fires when the user removes a file from the list of files that the user has chosen if that file was added by the app that is providing files.

 

Methods

The FileOpenPickerUI class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
AddFile Adds the specified file to the list of files that the user has chosen.
CanAddFile Indicates whether the specified file can be added to the list of files the user has chosen.
ContainsFile Determines whether the specified file is in the list of files that the user has chosen.
RemoveFile Removes the specified file from the list of files the user has chosen.

 

Properties

The FileOpenPickerUI class has these properties.

PropertyAccess typeDescription

AllowedFileTypes

Read-onlyGets a list of file types (extensions) that the user can choose.

SelectionMode

Read-onlyGets an enumeration value that indicates whether the file picker currently limits selection to single files, or if multiple files can be selected.

SettingsIdentifier

Read-onlyGets an identifier for the current context of the file picker.

Title

Read/writeGets or sets a title to display in the file picker UI that identifies the location that the file picker is displaying to the user.

 

Remarks

If your app participates in the File Open Picker contract, you can retrieve this object using a FileOpenPickerUI property while you handle a fileOpenPicker activated event.

Use one of the following properties to access a FileOpenPickerUI:

JavaScript:  Windows.UI.WebUI.webUIFileOpenPickerActivatedEventArgs.fileOpenPickerUI

C#/C++/VB:  Windows.ApplicationModel.Activation.FileOpenPickerActivatedEventArgs.FileOpenPickerUI

Learn about creating a good experience for users when they access your files through the file picker by reading the UX guidelines for providing files in Guidelines and checklist for file picker contracts.

Examples

The File picker sample demonstrates how to respond to a fileOpenPicker activated event.



// File open picker activated event handler
function activated(eventObject) {
    // Identify whether app is launched for fileOpenPicker
    if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.fileOpenPicker) {
        // Perform tasks to prepare your app to display its file picker page

        // Get file picker UI
        fileOpenPickerUI = eventObject.detail.fileOpenPickerUI;

        eventObject.setPromise(WinJS.UI.processAll().then(function () {
            // Navigate to either the first scenario or to the last running scenario
            // before suspension or termination.
            var url = scenarios[0].url;
            return WinJS.Navigation.navigate(url, fileOpenPickerUI);
        }));
    }
}

// Register the activated event handler
WinJS.Application.addEventListener("activated", activated, false);

For JavaScript, eventObject contains a webUIFileOpenPickerActivatedEventArgs object.

For C#, args contains a FileOpenPickerActivatedEventArgs object. Additionally, the OnFileOpenPickerActivated is in the App.xaml.cs file and the Activate method is in the FileOpenPickerPage.xaml.cs file of the File picker sample.

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Storage.Pickers.Provider
Windows::Storage::Pickers::Provider [C++]

Metadata

Windows.winmd

See also

Guidelines and checklist for file pickers
JavaScript reference
Windows.ApplicationModel.Activation.activationKind enumeration
Windows.UI.WebUI.webUIFileOpenPickerActivatedEventArgs class
C#/C++/VB reference
Windows.ApplicationModel.Activation.ActivationKind enumeration
Windows.ApplicationModel.Activation.FileOpenPickerActivatedEventArgs class

 

 

Show:
© 2014 Microsoft