FilePickerFileTypesOrderedMap FilePickerFileTypesOrderedMap FilePickerFileTypesOrderedMap 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

Declaration

public sealed class FilePickerFileTypesOrderedMappublic sealed class FilePickerFileTypesOrderedMapPublic NotInheritable Class FilePickerFileTypesOrderedMappublic sealed class FilePickerFileTypesOrderedMap

Remarks

Instances of the FilePickerFileTypesOrderedMap class supply the value for the 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";
// 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";

Properties summary

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

Methods summary

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

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

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

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

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

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

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

Properties

  • Size
    Size
    Size
    Size

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

    public uint Size { get; }public uint Size { get; }Public ReadOnly Property Size As uintpublic uint Size { get; }

    Property Value

    • uint
      uint
      uint
      uint

      The number of items in the mapped collection.

Methods

  • Clear()
    Clear()
    Clear()
    Clear()

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

    public void Clear()public void Clear()Public Function Clear() As voidpublic void Clear()
  • First()
    First()
    First()
    First()

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

    public IIterator<IKeyValuePair<string, IVector<string>>> First()public IIterator<IKeyValuePair<string, IVector<string>>> First()Public Function First() As IIterator( Of IKeyValuePairstring, IVectorstring )public IIterator<IKeyValuePair<string, IVector<string>>> First()

    Returns

    • The iterator.

  • GetView()
    GetView()
    GetView()
    GetView()

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

    public IMapView<string, IVector<string>> GetView()public IMapView<string, IVector<string>> GetView()Public Function GetView() As IMapView( Of string, IVectorstring )public IMapView<string, IVector<string>> GetView()

    Returns

    • 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 bool HasKey(String key)public bool HasKey(String key)Public Function HasKey(key As String) As boolpublic bool HasKey(String key)

    Parameters

    • key
      System.String
      System.String
      System.String
      System.String

      The key.

    Returns

    • bool
      bool
      bool
      bool

      True if the key is found; otherwise, false.

  • Insert(String, IVector<String>)
    Insert(String, IVector<String>)
    Insert(String, IVector<String>)
    Insert(String, IVector<String>)

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

    public bool Insert(String key, IVector<String> value)public bool Insert(String key, IVector<String> value)Public Function Insert(key As String, value As IVector<String>) As boolpublic bool Insert(String key, IVector<String> value)

    Parameters

    • key
      System.String
      System.String
      System.String
      System.String

      The key associated with the item to insert.

    • value

      The item to insert.

    Returns

    • bool
      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<string> Lookup(String key)public IVector<string> Lookup(String key)Public Function Lookup(key As String) As IVector( Of string )public IVector<string> Lookup(String key)

    Parameters

    • key
      System.String
      System.String
      System.String
      System.String

      The key to use to locate the item.

    Returns

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

  • 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(String key)public void Remove(String key)Public Function Remove(key As String) As voidpublic void Remove(String key)

    Parameters

    • key
      System.String
      System.String
      System.String
      System.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(String).

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute

Details

Assembly

Windows.Storage.Pickers.dll