title: WPF - converting Bitmap to ImageSource
body: <p>I need to convert a <code>System.Drawing.Bitmap</code> into <code>System.Windows.Media.ImageSource</code> class in order to bind it into a HeaderImage control of a WizardPage (Extended WPF toolkit).
  The bitmap is set as a resource of the assembly I write.
  It is being referenced like that:</p>
  <pre><code>public Bitmap GetBitmap
  {
     get
     {
        Bitmap bitmap = new Bitmap(Resources.my_banner);
        return bitmap;
     }
  }
  
  public ImageSource HeaderBitmap
  {
     get
     {
        ImageSourceConverter c = new ImageSourceConverter();
        return (ImageSource)c.ConvertFrom(GetBitmap);
     }
  }
  </code></pre>
  <p>The converter was found by me <a href="http://www.codeproject.com/Questions/621920/How-to-convert-Bitmap-to-ImageSource" rel="noreferrer">here</a>. I get a NullReferenceException at</p>
  <pre><code>return (ImageSource) c.ConvertFrom(Resources.my_banner);
  </code></pre>
  <p>How can I initialize ImageSource in order to avoid this exception? Or is there another way?
  I want to use it afterwards like:</p>
  <pre><code>&lt;xctk:WizardPage x:Name=&quot;StartPage&quot; Height=&quot;500&quot; Width=&quot;700&quot;
                   HeaderImage=&quot;{Binding HeaderBitmap}&quot; 
                   Enter=&quot;StartPage_OnEnter&quot;
  </code></pre>
  <p>Thanks in advance for any answers.</p>