问题
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