Dela via


FileSavePickerUI Class

Definition

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

public ref class FileSavePickerUI sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class FileSavePickerUI final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class FileSavePickerUI
Public NotInheritable Class FileSavePickerUI
Inheritance
Object Platform::Object IInspectable FileSavePickerUI
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

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

// fileSavePicker activated event handler
protected override void OnFileSavePickerActivated(FileSavePickerActivatedEventArgs args)
{
    var FileSavePickerPage = new SDKTemplate.FileSavePickerPage();
    FileSavePickerPage.Activate(args);
}

// Overloaded method to respond to fileSavePicker events
internal void Activate(FileSavePickerActivatedEventArgs args)
{
    // Perform tasks to prepare your app to display its file picker page

    // Get file picker UI
    fileSavePickerUI = args.FileSavePickerUI;

    Window.Current.Content = this;
    this.OnNavigatedTo(null);
    Window.Current.Activate();
}

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.

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 the FileSavePickerActivatedEventArgs.FileSavePickerUI property to retrieve a fileSavePickerUI object.

To learn about creating a good experience for users when they use your app as a save location, see Open files and folders with a picker.

Properties

AllowedFileTypes

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

FileName

Gets 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

Gets an identifier for the current context of the file picker.

Title

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

Methods

TrySetFileName(String)

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

Events

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.

Applies to

See also