Xamarin: Image is no longer visible when updating

0

From the application, I take pictures and they are saved in a list, when making the photo it looks good, but when the view is updated (or it is given to the back button and then it returns, or similar) the photo is left to see.
You can see it is there, because an item appears in the list, but the photo is not visible.

I searched and found nothing related.

The code:

private async void TakePicture()
    {
        await CrossMedia.Current.Initialize();

        if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
        {
            await App.Current.MainPage.DisplayAlert("No hay cámara", "No hay cámara disponible.", "Aceptar");
        }

        var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions());

        if (file != null)
        {
            ImageSource = ImageSource.FromStream(() =>
            {
                var stream = file.GetStream();
                file.Dispose();
                return stream;
            });
            var imagenAux = new Imagen();
            imagenAux.Image = ImageSource;
            Imagenes.Add(imagenAux);
        }
    }

    .....


public class Imagen
{
    public ImageSource Image { get; set; }
}
    
asked by Dani Paredes 30.08.2018 в 13:48
source

0 answers