FileOpenPicker.FileTypeFilter FileOpenPicker.FileTypeFilter FileOpenPicker.FileTypeFilter FileOpenPicker.FileTypeFilter FileOpenPicker.FileTypeFilter Property

Definition

Gets the collection of file types that the file open picker displays.

public : IVector<Platform::String> FileTypeFilter { get; }
IVector<winrt::hstring> FileTypeFilter();
public IList<string> FileTypeFilter { get; }
Public ReadOnly Property FileTypeFilter As IList<string>
var iList = fileOpenPicker.fileTypeFilter;

Property Value

IList<string> IList<string> IList<string>

A fileExtensionVector object that contains a collection of file types (file name extensions) , such as ".doc" and ".png". File name extensions are stored in this array as string objects.

Examples

The File picker sample demonstrates how to specify the file types that the user can see and pick from in the file picker.

FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
openPicker.FileTypeFilter.Add(".jpg");
openPicker.FileTypeFilter.Add(".jpeg");
openPicker.FileTypeFilter.Add(".png");
// Create the picker object and set options
var openPicker = new Windows.Storage.Pickers.FileOpenPicker();
openPicker.viewMode = Windows.Storage.Pickers.PickerViewMode.thumbnail;
openPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.picturesLibrary;
// Users expect to have a filtered view of their folders depending on the scenario.
// For example, when choosing a documents folder, restrict the filetypes to documents for your application.
openPicker.fileTypeFilter.replaceAll([".png", ".jpg", ".jpeg"]);
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.List;
openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
openPicker.FileTypeFilter.Add("*");
var openPicker = new Windows.Storage.Pickers.FileOpenPicker();
openPicker.viewMode = Windows.Storage.Pickers.PickerViewMode.list;
openPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.documentsLibrary;
openPicker.fileTypeFilter.replaceAll(["*"]);

See also