I see lots of threads with regard to using the WPF Image control in the same way as a Forms.PictureBox was used, but none seem to answer my question.
My WPF application takes as input a series of System.Drawing.Bitmap objects. I CANNOT change this behaviour in the short term. All I want to do is display these bitmaps, sequentially, in a window. This was soooo easy with Windows Forms, but with WPF it seems far from straightforward. WPF seems to assume I can easily reference my bitmap via a URI, but I can't.
The only solution I have working at the moment is to convert a System.Drawing.Bitmap to a System.Windows.Media.Imaging.BitmapSource by using unmanaged code (System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap) which seems absolutely ludicrous and is also leaking memory like a sieve.
Could someone provide me with a sample of how to achieve my goal without the need to use unmanaged code or jumping through too many hoops.
I see some great advantages of using WPF over Windows.Forms, but when I cannot achieve the equivalent of:
Windows.Forms.PictureBox.Image = myBitMapObjectThatAlreadyExistsAndIsNotReferencedViaAUri
without needing to write posts on forums I start to believe that Microsoft's continued "let's start with a clean sheet" approach has a few flaws.
Thanks for listening.