Windows store apps 为什么Windows应用商店应用程序中未打开文档文件夹?

Windows store apps 为什么Windows应用商店应用程序中未打开文档文件夹?,windows-store-apps,fileopenpicker,Windows Store Apps,Fileopenpicker,在下面的代码中,不会显示documents文件夹以拾取文件。功能设置正确(我认为),否则将引发异常。如果我设置了一个断点,我会看到代码到达了await语句,但是它就在那里,什么也没有发生 Private Async Function按钮\u单击\u 1(发送方作为对象,e作为RoutedEventArgs)作为任务 如果ApplicationView.tryunsap=False,则 StatusMessage=“无法取消捕捉。” 退出功能 如果结束 Dim filePicker作为新的File

在下面的代码中,不会显示documents文件夹以拾取文件。功能设置正确(我认为),否则将引发异常。如果我设置了一个断点,我会看到代码到达了await语句,但是它就在那里,什么也没有发生

Private Async Function按钮\u单击\u 1(发送方作为对象,e作为RoutedEventArgs)作为任务
如果ApplicationView.tryunsap=False,则
StatusMessage=“无法取消捕捉。”
退出功能
如果结束
Dim filePicker作为新的FileOpenPicker
filePicker.SuggestedStartLocation=PickerLocationId.DocumentsLibrary
filePicker.ViewMode=PickerViewMode.缩略图
filePicker.FileTypeFilter.Add(“.pbn”)
Dim pbnFile=等待filePicker.PickSingleFileAsync
如果pbnFile不是空的,那么
StatusMessage=pbnFile.Path
如果结束
端函数
编辑:上述方法中的第一行必须是:

If ApplicationView.Value = ApplicationViewState.Snapped AndAlso ApplicationView.TryUnsnap = False Then
问题解决了

XAML:


选择.pbn文件
这是因为您的

尝试捕捉你的应用程序,然后它将按预期工作。卸下退出功能部件,它将按预期工作