tags:

views:

50

answers:

0

Hello,
I am trying to capture my application's canvas as a bitmap to send to a printer.
Following some examples I have found:

WriteableBitmap bitmap = new WriteableBitmap(root.Width, root.Height);
ScaleTransform st = new ScaleTransform();
bitmap.Render(root, st);
Image img = new image();
Canvas cnvs = new Canvas() { Width = root.Width, Height = root.Height );
cnvs.Children.Add(img);
img.Source = bitmap;

Unfortunately, after bitmap.Render(), the bitmap is still empty.
'root' is a canvas with a number of objects on it.
Any hints on how to get this to work would be appreciated...
Thanks.

UPDATE:
This seems to work:

WriteableBitmap bitmap = new Writeablebitmap(root, scaleTransform);