ArctionPasi wrote:You can simply use chart.SaveToFile("picture.bmp");
Works in both WPF and Winforms.
Hi Parsi,
Thanks for the code. It works. However i am encountering an issue. Just a little backgroud, my chart is declared in the xaml file and is not shown on application startup. User will have to explictly click on a button in order to show the chart. On application startup, when the chart is still hidden but with all the data for the chart initialised, i encounter an exception "Saving to file failed: Make sure you have defined a valid target path, with write permission".
However, saving of the screenshot succeeds if save it after showing the chart. Even if i were to hide the chart subsequently, i am also able to save the screenshot successfully.
May i know what is the problem with it? I have checked that the chart is not null and has been initialised with all the data on startup.
Please advise.