FileSavePickerUI class

Applies to Windows and Windows Phone

Used to interact with the file picker when your app provides a save location with the File Save Picker contract.

Syntax


var fileSavePickerUI = fileSavePickerActivatedEventArgs.fileSavePickerUI;

Attributes

[Version(0x06020000)]

Members

The FileSavePickerUI class has these types of members:

Events

The FileSavePickerUI class has these events.

EventDescription
FileNameChanged Fired when the user changes the file name in the file name text box or changes the extension in the file type drop-down menu.
TargetFileRequested Fires when the user commits a file to be saved in the file picker.

 

Methods

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

MethodDescription
TrySetFileName Tries to set the file name and extension in the file picker UI.

 

Properties

The FileSavePickerUI class has these properties.

PropertyAccess typeDescription

AllowedFileTypes

Read-onlyGets a list of file types (extensions) that can be saved to the app that is providing the save location.

FileName

Read-onlyGets the full file name of the file to save, including the file type extension. The file name and extension are specified by the user.

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 Save Picker contract, you can access this object using a fileSavePickerUI property while you handle a filesavepicker activated event.

Use one of the following properties to retrieve a fileSavePickerUI object:

JavaScript:  webUIFileSavePickerActivatedEventArgs.fileSavePickerUI

C#/C++/VB:  FileSavePickerActivatedEventArgs.FileSavePickerUI

To learn about creating a good experience for users when they use your app as a save location, see Guidelines and checklist for file picker contracts.

Examples

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



// fileSavePicker activated event handler
function activated(eventObject) {
    // Identify whether app is launched for fileSavePicker
    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 webUIFileSavePickerActivatedEventArgs object.

For C#, args contains a FileSavePickerActivatedEventArgs object. Additionally, the OnFileSavePickerActivated is in the App.xaml.cs file and the Activate method is in the FileSavePickerPage.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
Windows.UI.WebUI.webUIFileOpenPickerActivatedEventArgs.fileSavePickerUI
C#/C++/VB reference
Windows.ApplicationModel.Activation.ActivationKind
Windows.ApplicationModel.Activation.FileOpenPickerActivatedEventArgs.FileSavePickerUI

 

 

Show:
© 2014 Microsoft