I'm trying to make an Image
out of one of my Canvas
(myPrintingCanvas
). But the Width of the image is getting atleast twice wider than the Canvas, and the extra space that is created is back. If I try on another Canavas
(LayoutRoot
), it works as intended.
My observation is that on myPrintingCanvas
the ActualWidth is always 0. LayoutRoot
has a correct ActualWidth
. Not sure if it has anything to do with the extra padding, and I have failed on getting the ActualWidth
for myPrintingCanvas
(using UpdateLayout
and Measure
).
Code:
//Code to render the content of myPrintingCanvas
...
//Make the WriteableBitmap
WriteableBitmap myWriteableBitmap = new WriteableBitmap(myPrintingCanvas, null);