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("*");

適用於

另請參閱