我有以下代码:
//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();
此代码有效,但文件未显示;在所有文件夹中说:"此文件夹为空",这非常具有误导性。
即使取消注释行openPicker.FileTypeFilter.Add(".db");
,也会显示任何内容,尽管有somje .db文件。
是否有可能在文件夹选择器中显示文件?
答案 0 :(得分:0)
当然,此代码会显示“此文件夹为空”,您要查找“ .db ”文件而非文件夹:< / p>
尝试此操作(将“ FolderPicker ”更改为“ 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();
编辑:如果使用“FolderPicker”选择文件,“此文件夹为空”表示此文件夹中没有“文件夹”(不是文件)。