Universal Windows Platform (UWP)
A Microsoft platform for building and publishing apps for Windows desktop devices.
2,526 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have code:
IReadOnlyList filesInOpenedFolder = await openedFolder.GetFilesAsync();
I want only get image files. Is it possible?
Acceptable is to get files with .gif, .jpg, .bmp extensions.
Hello,
Welcome to Microsoft Q&A!
You can use QueryOptions class to query the specified file type in app data folder.
StorageFolder folder = ApplicationData.Current.LocalFolder;
List fileTypeFilter = new List();
fileTypeFilter.Add(".jpg");
fileTypeFilter.Add(".bmp");
fileTypeFilter.Add(".gif");
QueryOptions queryOptions = new QueryOptions(Windows.Storage.Search.CommonFileQuery.OrderByName, fileTypeFilter);
StorageFileQueryResult queryResult = folder.CreateFileQueryWithOptions(queryOptions);
var files = await queryResult.GetFilesAsync();