3
如何在xaml 2012中创建打开的文件对话框,因为我是新的metro样式。我知道C#2010那里有一个打开文件对话框的选项这里没有选项,所以我如何能打开文件对话框任何人都可以告诉我如何做到这一点?如何在metro样式应用程序中打开文件对话框xaml 2012
谢谢。
如何在xaml 2012中创建打开的文件对话框,因为我是新的metro样式。我知道C#2010那里有一个打开文件对话框的选项这里没有选项,所以我如何能打开文件对话框任何人都可以告诉我如何做到这一点?如何在metro样式应用程序中打开文件对话框xaml 2012
谢谢。
在一个metro风格的应用程序(WinRT)中,您可以使用FileOpenPicker class来达到此目的。这里有一个例子:
var filePicker = new FileOpenPicker();
filePicker.FileTypeFilter.Add(".jpg");
filePicker.FileTypeFilter.Add(".jpeg");
filePicker.FileTypeFilter.Add(".gif");
filePicker.ViewMode = PickerViewMode.Thumbnail;
filePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
filePicker.SettingsIdentifier = "PicturePicker";
filePicker.CommitButtonText = "Select Files";
var selectedFiles = await filePicker.PickMultipleFilesAsync();
if (selectedFiles != null)
{
// do something with the selected files
}
有一个示例项目,演示它here。