Reputation: 33
How do i make a open file dialog in xaml 2012 as i am new to metro style. I know c# 2010 there there is an option of open file dialog here there is no option so how can i make a open file dialog can anyone suggest me how to do it?
Thank You.
Upvotes: 3
Views: 6304
Reputation: 3694
In a metro style app (WinRT), you would use the FileOpenPicker class for this purpose. Here's an example:
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
}
There's an example project that demonstrates it here.
Upvotes: 4