I have a Bitmap list where I store some images. Then I want an Image element on a WPF UserControl to be the first element of that list. For that I tried this:
Image2.Source = myBitmapArray[0].ToBitmapImage();
Where ToBitmapImage is a static function that looks like this:
public static BitmapImage ToBitmapImage(this Bitmap bitmap)
    {
        BitmapImage bitmapImage = new BitmapImage();
        using (MemoryStream memoryStream = new MemoryStream())
        {
            bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Bmp);
            memoryStream.Position = 0;
            bitmapImage.BeginInit();
            bitmapImage.StreamSource = memoryStream;
            bitmapImage.EndInit();
        }
        return bitmapImage;
    }
But when I assign the BitmapImage to my Image.Source it doesn't show the image. What I'm doing wrong?
 
    