Windows Phone Folder Picker - Show files

喜欢而已 提交于 2020-01-06 12:47:18

问题


I have following code:

//open folder picker ui
FolderPicker openPicker = new FolderPicker();
openPicker.ViewMode = PickerViewMode.List;
openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
//openPicker.FileTypeFilter.Add(".db");
openPicker.CommitButtonText = "Choose location";
openPicker.ContinuationData["Operation"] = "OpenFolder";
openPicker.PickFolderAndContinue();

This code works, but files arend't displayed; in all folders say: "This folder is empty", which is very missleading.
Even with uncommenting the line openPicker.FileTypeFilter.Add(".db"); nothing is displayed although there are somje .db files. Is there any possibility to show files in a folder picker?


回答1:


Of course this code will give you "This folder is empty", you looking for ".db" files not folders :

Try this ( Change "FolderPicker" to "FileOpenPicker" ) :

FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.List;
openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
openPicker.FileTypeFilter.Add(".db");
openPicker.CommitButtonText = "Choose location";
openPicker.ContinuationData["Operation"] = "OpenFolder";
openPicker.PickMultipleFilesAndContinue();

EDIT : In case of using "FolderPicker" to slect files, "This folder is empty" mean there is no "folders" ( not files ) in this folder .



来源:https://stackoverflow.com/questions/27380887/windows-phone-folder-picker-show-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!