FilePickerFileTypesOrderedMap Class

Definition

Represents a collection of display names mapped to the associated file types (extensions). Each element in this collection maps a display name to a corresponding collection of file name extensions. The key is a single string, the value is a list/vector of strings representing one or more extension choices.

public ref class FilePickerFileTypesOrderedMap sealed : IIterable<IKeyValuePair<Platform::String ^, IVector<Platform::String ^> ^> ^>, IMap<Platform::String ^, IVector<Platform::String ^> ^>
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class FilePickerFileTypesOrderedMap final : IIterable<IKeyValuePair<winrt::hstring, IVector<winrt::hstring> const&>>, IMap<winrt::hstring, IVector<winrt::hstring> const&>
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class FilePickerFileTypesOrderedMap final : IIterable<IKeyValuePair<winrt::hstring, IVector<winrt::hstring> const&>>, IMap<winrt::hstring, IVector<winrt::hstring> const&>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class FilePickerFileTypesOrderedMap : IDictionary<string,IList<string>>, IEnumerable<KeyValuePair<string,IList<string>>>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class FilePickerFileTypesOrderedMap : IDictionary<string,IList<string>>, IEnumerable<KeyValuePair<string,IList<string>>>
Public NotInheritable Class FilePickerFileTypesOrderedMap
Implements IDictionary(Of String, IList(Of String)), IEnumerable(Of KeyValuePair(Of String, IList(Of String)))
Inheritance
Object Platform::Object IInspectable FilePickerFileTypesOrderedMap
Attributes
Implements
IDictionary<String,IList<String>> IMap<Platform::String,IVector<Platform::String>> IMap<winrt::hstring,IVector<winrt::hstring>> IIterable<IKeyValuePair<K,V>> IEnumerable<KeyValuePair<K,V>> IEnumerable<KeyValuePair<String,IList<String>>> IIterable<IKeyValuePair<Platform::String,IVector<Platform::String>>> IIterable<IKeyValuePair<winrt::hstring,IVector<winrt::hstring>>>

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

The File picker sample demonstrates how to add file type choices with a display name.

FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
savePicker.FileTypeChoices.Add("Plain Text", new List<string>() { ".txt" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "New Document";

Remarks

Instances of the FilePickerFileTypesOrderedMap class supply the value for the FileSavePicker.FileTypeChoices property. By strict typing, the FileTypeChoices property takes a generic map where the value is a generic vector of strings. But the FilePickerFileTypesOrderedMap class implements this combination of interfaces as a concrete class, so you should always use an FilePickerFileTypesOrderedMap object for a FileTypeChoices value.

The key for an entry in a FilePickerFileTypesOrderedMap is a string that represents a friendly-name/displayname classification of what a file type is intended for. For example, "Plain Text" is an appropriate key for a FilePickerFileTypesOrderedMap where one of the associated file type extensions is ".txt".One display name as a classification of file types might have multiple file types that support it. For example, a display name of "HTML page" could be saved either with ".htm" or ".html" extension. That is why the value of each entry in a FilePickerFileTypesOrderedMap is an ordered list (vector) of strings, displayed in the UI in the order that you place the extensions in the vector.

Collection member lists

For JavaScript, FilePickerFileTypesOrderedMap supports using an index to access items.

Properties

Size

Gets the number of items in the mapped collection of display names and associated file types.

Methods

Clear()

Removes all display names and associated file name extensions from the collection.

First()

Retrieves an iterator that iterates through the display names and associated file types in the collection.

GetView()

Returns an immutable view of the collection of display names and associated file types.

HasKey(String)

Determines whether the mapped collection of display names and associated file types contains the specified key.

Insert(String, IVector<String>)

Inserts or replaces an item in the mapped collection of display names and associated file types.

Lookup(String)

Returns the item at the specified key in the mapped collection of display names and associated file types.

Remove(String)

Removes an item from the mapped collection of display names and associated file types.

Applies to

See also