///
/// An empty page that can be used on its own or navigated to within a Frame.
///
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
///
/// Invoked when this page is about to be displayed in a Frame.
///
/// Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
async private void OpeningMessage_Tapped(object sender, TappedRoutedEventArgs e)
{
// Display a FileOpenPicker and allow the user to select a photo
var picker = new FileOpenPicker();
picker.FileTypeFilter.Add(".jpg");
picker.FileTypeFilter.Add(".png");
picker.FileTypeFilter.Add(".bmp");
picker.FileTypeFilter.Add(".gif");
picker.ViewMode = PickerViewMode.Thumbnail;
picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
var file = await picker.PickSingleFileAsync();
if (file != null)
{
var stream = await file.OpenAsync(FileAccessMode.Read);
// Wrap a WriteableBitmap around the selected photo and display it
WriteableBitmap bitmap = new WriteableBitmap(1, 1);
bitmap.SetSource(stream);
Photo.Source = bitmap;