title: Converting Bitmap to ImageSource
body: <p>I'm trying to take a screen shot and set it as background of a WPF window. 
  This is my code to convert screenshot to ImageSource, I'm getting a NullReferenceException when converting from bitmap. How to do this properly?</p>
  
  <pre><code>    Dim screenSize = Forms.SystemInformation.PrimaryMonitorSize
      Dim bitmap = New System.Drawing.Bitmap(screenSize.Width, screenSize.Height)
      Dim g = System.Drawing.Graphics.FromImage(bitmap)
      g.CopyFromScreen(New System.Drawing.Point(0, 0), New System.Drawing.Point(0, 0), screenSize)
      g.Flush()
      Dim c As ImageSourceConverter = New ImageSourceConverter()
      Dim img As ImageSource = c.ConvertFrom(bitmap)
  </code></pre>