title: WPF - Update "System.Windows.Controls.Image" from another thread
body: <p>I get this exception on that code.
  How to fix it?</p>
  
  <p>Excepton:</p>
  
  <blockquote>
    <p>The calling thread cannot access this
    object because a different thread owns
    it.</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>    void CamProc_NewTargetPosition(IntPoint Center, System.Drawing.Bitmap image)
      {
          IntPtr hBitMap = image.GetHbitmap();
          BitmapSource bmaps = Imaging.CreateBitmapSourceFromHBitmap(hBitMap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
  
          Dispatcher.BeginInvoke((Action)(() =&gt;
          {
              labelX.Content = String.Format("X: {0}", Center.X); //OK Working
              labelY.Content = String.Format("Y: {0}", Center.Y); //OK Working
              pictureBoxMain.Source = bmaps; // THERE IS EXCEPTON
          }), DispatcherPriority.Render, null);
  
      }
  </code></pre>
  
  <p>pictureBoxMain is System.Windows.Controls.Image.</p>