FileOpenPicker.FileTypeFilter 属性

定义

获取文件打开选取器显示的文件类型的集合。

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

属性值

IVector<String>

IList<String>

IVector<Platform::String>

IVector<winrt::hstring>

fileExtensionVector 对象,其中包含) 文件扩展名 (文件类型集合,例如“.doc”和“.png”。 (例如“.txt”) ,除非仅指定通配符“*”,否则在文件扩展名之前使用 . 。 请参阅以下示例。 文件扩展名作为 字符串 对象存储在此数组中。

示例

文件选取器示例演示如何指定用户可以在文件选取器中查看和选取的文件类型。

FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
openPicker.FileTypeFilter.Add(".jpg");
openPicker.FileTypeFilter.Add(".jpeg");
openPicker.FileTypeFilter.Add(".png");
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.List;
openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
openPicker.FileTypeFilter.Add("*");

适用于

另请参阅