FileSavePicker class

3 out of 3 rated this helpful - Rate this topic

Represents a file picker that lets the user choose the file name, extension, and storage location for a file.

Syntax


public ref class FileSavePicker sealed : Object

Attributes

ActivatableAttribute(NTDDI_WIN8)
MuseAttribute()
VersionAttribute(NTDDI_WIN8)

Members

The FileSavePicker class has these types of members:

Constructors

The FileSavePicker class has these constructors.

ConstructorDescription
FileSavePicker Creates a new instance of a FileSavePicker.

 

Methods

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

MethodDescription
PickSaveFileAsync Shows the file picker so that the user can save a file and set the file name, extension, and location of the file to be saved.

 

Properties

The FileSavePicker class has these properties.

PropertyAccess typeDescription

CommitButtonText

Read/writeGets or sets the label text of the commit button in the file pickerUI.

DefaultFileExtension

Read/writeGets or sets the default file name extension that the fileSavePicker gives to files to be saved.

FileTypeChoices

Read-onlyGets the collection of valid file types that the user can choose to assign to a file.

SettingsIdentifier

Read/writeGets or sets the settings identifier associated with the current FileSavePicker instance.

SuggestedFileName

Read/writeGets or sets the file name that the file save picker suggests to the user.

SuggestedSaveFile

Read/writeGets or sets the storageFile that the file picker suggests to the user for saving a file.

SuggestedStartLocation

Read/writeGets or sets the location that the file save picker suggests to the user as the location to save a file.

 

Remarks

To learn how to save files through the file picker, see How to save files through file pickers.

To get started accessing files and folders file pickers, see Quickstart: Accessing files with file pickers.

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

Examples

The File picker sample demonstrates how to check whether the app is snapped, how to set file picker properties, and how to show a file picker so that the user can save a file.

No code example is currently available or this language may not be supported.

For C#, the File picker sample demonstrates how to check whether your app is snapped in the EnsureUnsnapped method.


internal bool EnsureUnsnapped()
{
    // FilePicker APIs will not work if the application is in a snapped state.
    // If an app wants to show a FilePicker while snapped, it must attempt to unsnap first
    bool unsnapped = ((ApplicationView.Value != ApplicationViewState.Snapped) || ApplicationView.TryUnsnap());
    if (!unsnapped)
    {
        NotifyUser("Cannot unsnap the sample.", NotifyType.StatusMessage);
    }

    return unsnapped;
}


Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Namespace

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

Metadata

Windows.winmd

See also

File picker sample
Quickstart: Accessing files with file pickers
How to save files through file pickers
Windows.Storage.StorageFile class

 

 

Build date: 2/25/2013

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.