I need a FileOpenPicker without any FileTypeFilter !! When i do not add any FileTypeFilter then it gives an exception like : "The FileTypeFilters property must have at least one file type filter specified." But I need to see al types of files in the 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);
}
Can anyone help me out?
Use:
fileOpenPicker.FileTypeFilter.Add("*");
To be able to select any type.
FileOpenPicker.FileTypeFilter - Gets the collection of file types that the file open picker displays.
FileOpenPicker fileOpenPicker = new FileOpenPicker();
fileOpenPicker.ViewMode = PickerViewMode.Thumbnail;
fileOpenPicker.FileTypeFilter.Add("*");
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);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With