Windows Phone文件夹选择器-显示文件 [英] Windows Phone Folder Picker - Show files
问题描述
我有以下代码:
//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文件.
有可能在文件夹选择器中显示文件吗?
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?
推荐答案
当然,此代码将为您提供此文件夹为空",您需要查找" .db " 文件不是文件夹:
Of course this code will give you "This folder is empty", you looking for ".db" files not folders :
尝试一下(将" FolderPicker "更改为" FileOpenPicker "):
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();
:如果使用"FolderPicker"选择文件,则此文件夹为空"表示此文件夹中没有文件夹"(不是文件).
EDIT : In case of using "FolderPicker" to slect files, "This folder is empty" mean there is no "folders" ( not files ) in this folder .
这篇关于Windows Phone文件夹选择器-显示文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!