title: Save screenshot of WPF web browser Frame
body: <p>I have a <code>Frame</code> element displaying an html page in my WPF application, and would like to save a screenshot of the Frame as an image.</p>
  
  <p>With the help of the google, I have this code:</p>
  
  <pre><code>Size size = new Size(PreviewFrame.ActualWidth, PreviewFrame.ActualHeight);
  PreviewFrame.Measure(size);
  PreviewFrame.Arrange(new Rect(size));
  
  var renderBitmap = new RenderTargetBitmap(
              (int)size.Width,
              (int)size.Height,
              96d,
              96d,
              PixelFormats.Pbgra32);
  renderBitmap.Render(PreviewFrame);
  </code></pre>
  
  <p>But all I ever get is a blank image.</p>
  
  <p>Any thoughts on how to fix this code, and/or another way to capture a web page as an image in my app?</p>