Bit new to Maui, trying to update an ImageSource at runtime. I've been searching for quite a few hours now. Any help is welcome. The code runs without any errors, yet the 'Source' of the Image object remains 'null' (stream is ok)
eventArgs.Frame => System.Drawing.Bitmap
camcap => <Image x:Name="camcap"/>
using (MemoryStream stream = new MemoryStream())
{
eventArgs.Frame.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
MainThread.BeginInvokeOnMainThread(() => this.camcap.Source = ImageSource.FromStream(() => stream));
}
You can use the
OnAppearing()method to update an ImageSource at runtime. Here is the document about the OnAppearing() method you can refer to.