How to save offscreen chart of WinRTXamlToolkit.Controls.DataVisualization.Charting to png file?

Jul 8, 2016 at 11:07 AM
I am using WinRTXamlToolkit.Controls.DataVisualization.Charting to create chart, on foreground xaml page of winrt the chart is working properly.

I want to draw that chart in pdf by capturing its chart control's image using png image file.

I was able to draw image using png file on pdf, but the winrt RenderTargetBitmap not render that offscreen chart and i was not able get its image.

So is there any api for rendering offscreen control to image file.

Please reply me any workaround for this.

Jul 8, 2016 at 8:55 PM
I haven't tried it myself, but you could try capturing a chart from a control you place in the UI tree behind the visible UI. The Chart control has some complicated code that animates the chart and it probably runs after the control is loaded in the UI tree which in your case doesn't happen, so there might be nothing to render.

A better solution I would recommend is to render the chart yourself. Check out my sample that uses Win2D to render charts here:

Also note that this isn't the primary location of the toolkit anymore. It has moved to GitHub at