There's lots of other examples of using RenderTargetBitmap floating around
that don't use Measure/Arrange.
Here's just one:
http://blogs.msdn.com/swick/archive/...using-wpf.aspx
Mark
--
Mark Salsbery
Microsoft MVP - Visual C++
"Jon Harrop" <jon@xxxxxx> wrote in message
news

aSdnVgGD6f1e1XVnZ2dnUVZ8jidnZ2d@xxxxxx
Quote:
>
> I'd like to save a WPF control as a PNG image. I've tried using the
> following code:
>
> http://dvuyka.spaces.live.com/blog/c...E19A!240.entry
>
> but the calls the Measure and Arrange screw up the layout of the control
> which is then drawn incorrectly until the user resizes the window. I don't
> understate what state they've changed but I am unable to fix it. I've
> tried
> adding calls to InvalidateMeasure and InvalidateArrange and UpdateLayout
> but they do not fix the problem.
>
> I just discovered that you can use the backwards compatibility with
> WinForms
> stuff in "Forms.Integration" to create an ElementHost that has a
> DrawToBitmap method for Win32 bitmaps.
>
> What is the recommended way to do this? Am I really supposed to resort to
> calling the backwards compatibility stuff and using WinForms?
>
> --
> Dr Jon D Harrop, Flying Frog Consultancy Ltd.
> http://www.ffconsultancy.com/?u