For the image export functionality to work we need to have an UIElement drawn. You actually need the chart to be 800x600 for it to get export 800x600. You can export in any resolution and then try to re-sample the image into another but this will result in lose of quality.
I have a solution with a drawback.It makes the chart blink because it is removed from the visual tree and then added back. Here is a code snippet:
sender, RoutedEventArgs e)
SaveFileDialog dialog =
"PNG File (*.png) | *.png"
Canvas c =
RC1.Height = 600;
RC1.Width = 800;
Stream fileStream = dialog.OpenFile();
RC1.Height = Double.NaN;
RC1.Width = Double.NaN;
So what happens in the snippet:
1.First are the usual steps that you take to export.
2.For the actual saving I create a Canvas
and add it to the LayoutRoot.
3.Remove the chart from LayoutRoot
and add it to the Canvas
with a big negative Canvas.Top
4.Set the resolution needed to the chart (800x600).
5.This is the tricky part, Create a lambda expression and execute it with Dispetcher
. This will force the rest of the code to be executed after a layout cycle (the chart gets redrawn.)
6.Export the chart to file.
7.Remove chart from Canvas
and add it back to layout root.
I hope this will be of help.
Evgeni "Zammy" Petrov
the Telerik team
Browse the videos here>>
to help you get started with RadControls for Silverlight