C
C#2d ago
Gerjan

MediaPicker pictures not showing up properly after uploading with MAUI

Hey, I'm making an app where you can report an incident and also add pictures to it. After either picking a photo from gallery or making a new one, I want them to be shown after selecting. Showing them on the page is done using a collectionview binding to
public ObservableCollection<ImageSource> Photos { get; } = new(); In my Task AddPhotoAsync the taken or selected picture is put in result FileResult? result = choice switch { "Take Photo" => await MediaPicker.CapturePhotoAsync(new MediaPickerOptions { Title = $"incident_{DateTime.Now:yyyyMMddHHmmss}" }), "Choose Photo" => await MediaPicker.PickPhotoAsync(new MediaPickerOptions { Title = "Select a photo" }), => null }; After that the picture is added from the stream to the collection: if (result != null) { using var stream = await result.OpenReadAsync(); Photos.Add(ImageSource.FromStream(() => stream)); } Yet when I select a picture i only see a white box, shown in the screenshot i provided. This is both on windows and android. Anyone an idea how this is happening and how i can fix it?
No description
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?