the problem ist, that the background of the png-file ist black! how can i change this to white?
thanks a lot
1 Answer, 1 is accepted
answered on 18 Jul 2016, 08:58 AM
Thank you for the code-snippet provided.
When you export the ChartView to png, the background of the image should be the same as the background of the ChartView. If you are using e.g. Expression_Dark theme or you have set Background property of the chart to black, then the image should have the same color. However, you can change the Background of the chart only by export:
string filename = "ExportedChart.png";
var initialColor = this.chart.Background;
this.chart.Background = new SolidColorBrush(Colors.White);
using (Stream fileStream = File.Open(filename, FileMode.OpenOrCreate))
Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage(this.chart, fileStream, new PngBitmapEncoder());
this.chart.Background = initialColor;
I hope this information helps.
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.