Windows Dev Center

FilePickerFileTypesOrderedMap class

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.

Syntax


public sealed class FilePickerFileTypesOrderedMap : IDictionary<String, IVector>,
    IEnumerable<KeyValuePair>

Members

The FilePickerFileTypesOrderedMap class has these types of members:

Methods

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

MethodDescription
Add(KeyValuePair) [C#, VB]Adds a new key-value pair to the FilePickerFileTypesOrderedMap.
Add(String) [C#, VB]Adds an item to the FilePickerFileTypesOrderedMap.
Clear Removes all display names and associated file name extensions from the collection.
Contains [C#, VB]Returns a value that indicates whether a specified key-value pair exists in the FilePickerFileTypesOrderedMap.
ContainsKey [C#, VB]Returns a value that indicates whether a specified key exists in the FilePickerFileTypesOrderedMap.
CopyTo [C#, VB]Copies the elements of the collection to an array, starting at a particular array index.
First [C++, JavaScript]Retrieves an iterator that iterates through the display names and associated file types in the collection.
GetView [C++, JavaScript]Returns an immutable view of the collection of display names and associated file types.
HasKey [C++, JavaScript]Determines whether the mapped collection of display names and associated file types contains the specified key.
Insert [C++, JavaScript]Inserts or replaces an item in the mapped collection of display names and associated file types.
Lookup [C++, JavaScript]Returns the item at the specified key in the mapped collection of display names and associated file types.
Remove [C++, JavaScript]Removes an item from the mapped collection of display names and associated file types.
Remove(KeyValuePair) [C#, VB]Removes a specific key-value pair from the FilePickerFileTypesOrderedMap.
Remove(String) [C#, VB]Removes a specific item from the FilePickerFileTypesOrderedMap.
TryGetValue [C#, VB]Returns a value that indicates whether a specified key exists in the FilePickerFileTypesOrderedMap. If an item with that key exists, the item is retrieved as an out parameter.

 

Properties

The FilePickerFileTypesOrderedMap class has these properties.

PropertyAccess typeDescription

Count [C#, VB]

Read-onlyGets the number of elements contained in the collection.

IsReadOnly [C#, VB]

Read-onlyGets a value indicating whether the dictionary is read-only.

Item [C#, VB]

Read/writeGets or sets the element value at the specified key index.

Keys [C#, VB]

Read-onlyGets an ICollection object containing the keys of the FilePickerFileTypesOrderedMap.

Size [C++, JavaScript]

Read-onlyGets the number of items in the mapped collection of display names and associated file types.

Values [C#, VB]

Read-onlyGets an ICollection object containing the values of the FilePickerFileTypesOrderedMap.

 

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.

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";


Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

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

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

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
Windows::Storage::Pickers [C++]

Metadata

Windows.winmd

Attributes

[Version(0x06020000)]

See also

Object
IMap(String, IVector)
IIterable(IKeyValuePair)
File picker sample
Quickstart: Accessing files with file pickers (HTML)
Open files and folders with a picker
FileSavePicker.FileTypeChoices property

 

 

Show:
© 2015 Microsoft