FilePickerFileTypesOrderedMap FilePickerFileTypesOrderedMap FilePickerFileTypesOrderedMap 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 : sealed class FilePickerFileTypesOrderedMap : IIterable<IKeyValuePair<Platform::String, IVector<Platform::String>>>, IMap<Platform::String, IVector<Platform::String>>
public sealed class FilePickerFileTypesOrderedMap : IEnumerable<KeyValuePair<String, IList<String>>>, IDictionary<String, IList<String>>
Public NotInheritable Class FilePickerFileTypesOrderedMap Implements IEnumerable<KeyValuePair<String, IList<String>>>, IDictionary<String, IList<String>>
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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";
// Create the picker object and set options
var savePicker = new Windows.Storage.Pickers.FileSavePicker();
savePicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.documentsLibrary;
// Dropdown of file types the user can save the file as
savePicker.fileTypeChoices.insert("Plain Text", [".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

Item[TKey] Item[TKey] Item[TKey] Item[TKey]

Gets or sets the element with the specified key.

This member is not implemented in C++
TValue this[TKey key] { get; set; }
Property Item(key As TKey) As TValue
TValue this[TKey key] { get; set; }
Parameters
key
TKey TKey TKey TKey

The key of the element to get or set.

Value
TValue TValue TValue TValue

The element with the specified key.

Exceptions

key is null.

The property is retrieved and key is not found.

The property is set and the System.Collections.Generic.IDictionary`2 is read-only.

Keys Keys Keys Keys

Gets an System.Collections.Generic.ICollection`1 containing the keys of the System.Collections.Generic.IDictionary`2.

This member is not implemented in C++
ICollection<TKey> Keys { get; }
ReadOnly Property Keys As ICollection(Of TKey)
ICollection<TKey> Keys { get; }
Value

An System.Collections.Generic.ICollection`1 containing the keys of the object that implements System.Collections.Generic.IDictionary`2.

Size Size Size Size

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

public : unsigned int Size { get; }
This member is not implemented in C#
This member is not implemented in VB.Net
var uint = filePickerFileTypesOrderedMap.size;
Value
unsigned int uint uint uint

The number of items in the mapped collection.

Values Values Values Values

Gets an System.Collections.Generic.ICollection`1 containing the values in the System.Collections.Generic.IDictionary`2.

This member is not implemented in C++
ICollection<TValue> Values { get; }
ReadOnly Property Values As ICollection(Of TValue)
ICollection<TValue> Values { get; }
Value

An System.Collections.Generic.ICollection`1 containing the values in the object that implements System.Collections.Generic.IDictionary`2.

Methods

Add(TKey, TValue) Add(TKey, TValue) Add(TKey, TValue) Add(TKey, TValue)

Adds an element with the provided key and value to the System.Collections.Generic.IDictionary`2.

This member is not implemented in C++
void Add(TKey key, TValue value)
Sub Add(key As TKey, value As TValue)
void Add(TKey key, TValue value)
Parameters
key
TKey TKey TKey TKey

The object to use as the key of the element to add.

value
TValue TValue TValue TValue

The object to use as the value of the element to add.

Exceptions

key is null.

An element with the same key already exists in the System.Collections.Generic.IDictionary`2.

The System.Collections.Generic.IDictionary`2 is read-only.

Clear() Clear() Clear() Clear()

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

public : void Clear()
This member is not implemented in C#
This member is not implemented in VB.Net
filePickerFileTypesOrderedMap.clear();

ContainsKey(TKey) ContainsKey(TKey) ContainsKey(TKey) ContainsKey(TKey)

Determines whether the System.Collections.Generic.IDictionary`2 contains an element with the specified key.

This member is not implemented in C++
bool ContainsKey(TKey key)
Function ContainsKey(key As TKey) As Boolean
bool ContainsKey(TKey key)
Parameters
key
TKey TKey TKey TKey

The key to locate in the System.Collections.Generic.IDictionary`2.

Returns

true if the System.Collections.Generic.IDictionary`2 contains an element with the key; otherwise, false.

Exceptions

key is null.

First() First() First() First()

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

public : IIterator<IKeyValuePair<Platform::String, IVector<Platform::String>>> First()
This member is not implemented in C#
This member is not implemented in VB.Net
var iIterator = filePickerFileTypesOrderedMap.first();
Returns
IIterator<IKeyValuePair<Platform::String, IVector<Platform::String>>> IIterator<KeyValuePair<string, IList<string>>> IIterator<KeyValuePair<string, IList<string>>> IIterator<KeyValuePair<string, IList<string>>>

The iterator.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator that iterates through the collection.

This member is not implemented in C++
IEnumerator<T> GetEnumerator()
Function GetEnumerator As IEnumerator(Of T)
IEnumerator<T> GetEnumerator()
Returns

An enumerator that can be used to iterate through the collection.

GetView() GetView() GetView() GetView()

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

public : IMapView<Platform::String, IVector<Platform::String>> GetView()
This member is not implemented in C#
This member is not implemented in VB.Net
var iMapView = filePickerFileTypesOrderedMap.getView();
Returns
IMapView<Platform::String, IVector<Platform::String>> IReadOnlyDictionary<string, IList<string>> IReadOnlyDictionary<string, IList<string>> IReadOnlyDictionary<string, IList<string>>

The view of the collection.

HasKey(String) HasKey(String) HasKey(String) HasKey(String)

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

public : Platform::Boolean HasKey(Platform::String key)
This member is not implemented in C#
This member is not implemented in VB.Net
var bool = filePickerFileTypesOrderedMap.hasKey(key);
Parameters
key
Platform::String String String String

The key.

Returns
Platform::Boolean bool bool bool

True if the key is found; otherwise, false.

Insert(String, IVector) Insert(String, IVector) Insert(String, IVector) Insert(String, IVector)

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

public : Platform::Boolean Insert(Platform::String key, IVector<Platform::String> value)
This member is not implemented in C#
This member is not implemented in VB.Net
var bool = filePickerFileTypesOrderedMap.insert(key, value);
Parameters
key
Platform::String String String String

The key associated with the item to insert.

value
IVector<Platform::String> IList<String> IList<String> IList<String>

The item to insert.

Returns
Platform::Boolean bool bool bool

true if an item with the specified key is an existing item and was replaced; otherwise false.

Lookup(String) Lookup(String) Lookup(String) Lookup(String)

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

public : IVector<Platform::String> Lookup(Platform::String key)
This member is not implemented in C#
This member is not implemented in VB.Net
var iVector = filePickerFileTypesOrderedMap.lookup(key);
Parameters
key
Platform::String String String String

The key to use to locate the item.

Returns
IVector<Platform::String> IList<string> IList<string> IList<string>

The value, if an item with the specified key exists. Use the HasKey method to determine whether the key exists.

Remove(TKey) Remove(TKey) Remove(TKey) Remove(TKey)

Removes the element with the specified key from the System.Collections.Generic.IDictionary`2.

This member is not implemented in C++
bool Remove(TKey key)
Function Remove(key As TKey) As Boolean
bool Remove(TKey key)
Parameters
key
TKey TKey TKey TKey

The key of the element to remove.

Returns

true if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original System.Collections.Generic.IDictionary`2.

Exceptions

key is null.

The System.Collections.Generic.IDictionary`2 is read-only.

Remove(String) Remove(String) Remove(String) Remove(String)

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

public : void Remove(Platform::String key)
This member is not implemented in C#
This member is not implemented in VB.Net
filePickerFileTypesOrderedMap.remove(key);
Parameters
key
Platform::String String String String

The key associated with the item to remove.

Remarks

For the C# and Microsoft Visual Basic version of the Remove(String) method, see Remove.

TryGetValue(TKey, out TValue) TryGetValue(TKey, out TValue) TryGetValue(TKey, out TValue) TryGetValue(TKey, out TValue)

Gets the value associated with the specified key.

This member is not implemented in C++
bool TryGetValue(TKey key, out TValue value)
Function TryGetValue(key As TKey, ByRef value As TValue) As Boolean
bool TryGetValue(TKey key, out TValue value)
Parameters
key
TKey TKey TKey TKey

The key whose value to get.

value
TValue TValue TValue TValue

When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.

Returns

true if the object that implements System.Collections.Generic.IDictionary`2 contains an element with the specified key; otherwise, false.

Exceptions

key is null.

See Also