新的 Windows Phone 8.1 文件选择器让我们可以从任何位置选择文件,但我们必须点击选择器工具栏上的椭圆,然后“选择位置”才能像新的 OneDrive 应用程序默认那样列出文件。
我正在谈论的屏幕标题为“选择应用程序”,并列出了“照片”和“电话”等项目,它们是为文件选择器注册的本机应用程序。
此处显示的屏幕相同,当该人点击“选择文件”按钮时 https://www.youtube.com/watch?v=adR-lu8ZM6U#t=19
我想默认打开这个屏幕,而不是缩略图视图。更改 FileOpenPicker ViewMode 属性似乎没有任何效果。
我的代码现在就像这样,我现在既没有设置 ViewMode 也没有设置 SuggestedStartLocation:
private void OpenFilePicker()
{
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.FileTypeFilter.Add(".mp4");
openPicker.FileTypeFilter.Add(".avi");
App.ContinuationEventArgsChanged += OpenFile_ContinuationEventArgsChanged;
openPicker.PickSingleFileAndContinue();
}
private async void OpenFile_ContinuationEventArgsChanged(object sender, IContinuationActivatedEventArgs e)
{
App.ContinuationEventArgsChanged -= OpenFile_ContinuationEventArgsChanged;
var openFileArgs = e as FileOpenPickerContinuationEventArgs;
if (openFileArgs != null && openFileArgs.Files != null && openFileArgs.Files.Count > 0)
{
//do stuff with the file here
}
}
我想这应该是一个问题(来自http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.pickers.fileopenpicker.suggestedstartlocation.aspx):
“SuggestedStartLocation 并不总是用作文件选择器的起始位置。为了给用户一种一致性的感觉,文件选择器会记住用户导航到的最后一个位置,并且通常会从该位置开始。”
有什么建议吗?谢谢