在我的Windows 8.1中我试图显示文件夹选择器,但它以崩溃结束(App.g.i.cs文件中的调试器中断)。
这是我用于文件夹选择器的代码:
FolderPicker openFP = new FolderPicker();
openFP.ViewMode = PickerViewMode.Thumbnail;
openFP.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
StorageFolder SF = await openFP.PickSingleFolderAsync(); StorageApplicationPermissions.FutureAccessList.AddOrReplace("PickedFolderToken", SF);
this.Frame.Navigate(typeof(MainPage), SF.Name);
请给我任何解决方案
答案 0 :(得分:1)
我通过在代码中添加过滤器类型来获取文件夹选择器 代码:
FolderPicker openFP = new FolderPicker();
openFP.ViewMode = PickerViewMode.Thumbnail;
openFP.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
openFP.FileTypeFilter.Add(".jpeg");
openFP.FileTypeFilter.Add(".gif");
openFP.FileTypeFilter.Add(".png");
StorageFolder SF = await openFP.PickSingleFolderAsync(); StorageApplicationPermissions.FutureAccessList.AddOrReplace("PickedFolderToken", SF);
this.Frame.Navigate(typeof(MainPage), SF.Name);