private async void btnThumb_Tapped(object sender, TappedRoutedEventArgs e) { FileOpenPicker openPicker = new FileOpenPicker(); openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; openPicker.ViewMode = PickerViewMode.Thumbnail; // Filter to include a sample subset of file types. openPicker.FileTypeFilter.Clear(); openPicker.FileTypeFilter.Add(".bmp"); openPicker.FileTypeFilter.Add(".png"); openPicker.FileTypeFilter.Add(".jpeg"); openPicker.FileTypeFilter.Add(".jpg"); // Open the file picker. StorageFile file = await openPicker.PickSingleFileAsync(); BookViewModel.LoadFile(file); // 'file' is null if user cancels the file picker. if (file != null) { //Open a stream for the selected file. //The 'using' block ensures the stream is disposed //after the image is loaded. using (Stream stream = await file.OpenStreamForReadAsync()) { byte[] bytes = new byte[stream.Length]; await stream.ReadAsync(bytes, 0, bytes.Length); BookViewModel.Image = bytes; } } }