Search code examples
c#wpfxamlpng

How to convert a dynamic XAML into a PNG or GIF using C#?


I'm creating dynamic templated XAML designs that I would like to convert to PNG or GIF from my C# code.

Any ideas?


Solution

  • You need to use the RenderTargetBitmap class. MSDN has an example of how to convert a Visual to an image.