我需要一个没有任何FileTypeFilter的FileOpenPicker!当我不添加任何FileTypeFilter时,它将给出类似的异常:“FileTypeFilters属性必须至少指定一个文件类型过滤器。”但是我需要在FileOpenPicker中查看所有类型的文件!
FileOpenPicker fileOpenPicker = new FileOpenPicker();
fileOpenPicker.ViewMode = PickerViewMode.Thumbnail;
//fileOpenPicker.FileTypeFilter.Add(".txt"); I dot not need any filter !!
fileOpenPicker.CommitButtonText = "Select Files";
fileOpenPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
IReadOnlyList<StorageFile> files =await fileOpenPicker.PickMultipleFilesAsync();
List<string> fileList = new List<string>();
StringBuilder sb = new StringBuilder();
foreach (StorageFile file in files)
{
fileList.Add(file.Name);
sb.AppendLine(file.Name);
}
谁能帮我吗?
最佳答案
用:
fileOpenPicker.FileTypeFilter.Add("*");
为了能够选择任何类型。