Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

wpf

png

xaml

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

Any ideas?

like image 854
sachaa Avatar asked Mar 13 '10 21:03

sachaa


2 Answers

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

like image 121
Thomas Levesque Avatar answered Nov 14 '22 22:11

Thomas Levesque


Found an interesting article on how to do this...

Converting and customizing XAML to PNG with server-side WPF

like image 20
sachaa Avatar answered Nov 14 '22 21:11

sachaa