I am getting a file, via a picker and I am displaying that image in a Image control in xaml.
The image displays perfectly, but when I tried to convert the path to bytes, I get the error
Tried to give picture library permition
var picker = new FileOpenPicker();
picker.ViewMode = PickerViewMode.Thumbnail;
picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
picker.FileTypeFilter.Add(".jpg");
picker.FileTypeFilter.Add(".png");
picker.FileTypeFilter.Add(".jpeg");
var file = await picker.PickSingleFileAsync();
if (file != null) {
var stream = await file.OpenReadAsync();
var bitmap = new BitmapImage();
bitmap.SetSource(stream);
var bytes = File.ReadAllBytes(file.Path); // Error
selectedimage.Source = bitmap;
{"Access to the path 'some path' is denied."}