Exemplo n.º 1
0
        public static void SaveDynamicCanvas(DynamicCanvas canvas, int dpi, string filename)
        {
            Size size = new Size(canvas.Width, canvas.Height);

            canvas.Measure(size);
            canvas.Arrange(new Rect(size));
            var rtb = new RenderTargetBitmap(
                (int)canvas.Width,   //width
                (int)canvas.Height,  //height
                dpi,                 //dpi x
                dpi,                 //dpi y
                PixelFormats.Pbgra32 // pixelformat
                );

            rtb.Render(canvas);

            SaveRTBAsPNG(rtb, filename);
        }