Lets start from the very end: transparency won't be a problem, because PNG bitmaps support transparency:
http://en.wikipedia.org/wiki/Portable_Network_Graphics[
^].
For rendering of something like a control on a bitmap (you actually can render any
Visual
and hence any control; please see below), you need to use the classes
System.Windows.Media.DrawingVisual
and
System.Windows.Media.Imaging.RenderTargetBitmap
:
http://msdn.microsoft.com/en-us/library/system.windows.media.drawingvisual.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.rendertargetbitmap.aspx[
^].
If you look at the MSDN help page for the class
DrawingVisual
, referenced above, you will see a code sample for creating a bitmap from a
System.Windows.Media.Visual
, but for the
Visual
the class
System.Windows.Media.DrawingVisual
is used, which you don't need. What to do? Same thing;
DrawingVisual
is considered only to make the example short, but you will need to use something else.
Please look a the
Visual
class:
http://msdn.microsoft.com/en-us/library/system.windows.media.visual.aspx[
^].
You can see that this class is a base class for
System.Windows.UIElement
, and, hence, anything you are interested in. That solves your problem.
—SA