Hello
So I have a SfTabControle with a few TabItems and on each tab there is a SfChart that I want to export to an image. So the fist Tab is shown when the program starts and the Image looks fine but then the second and 3rd chart only exports a black box to an image. When I click on tab 2 and 3 and the Charts gets rendered for the first time then the image looks fine. Is there a way to force the chart to be rendered even if it has not been viewed yet or is there some kind of other workaround for this.
Hello
I have added this to my code now but now it gives me the following errors
{"The root Visual of a VisualTarget cannot have a parent."}
What could be causing this ?
Hello
I have managed to replicate my problem in your example by adding a tabControle and adding the SfChart in one of the TabItems. I have a feeling it has something to do with the chart now being a child of the Tabcontrole and can thus not be made a rootVisual.
|
private void Button_Click(object sender, RoutedEventArgs e)
{
var chart = A_chart;
if (A_chart.Parent == null)
{
HwndSourceParameters sourceParameters = new HwndSourceParameters();
sourceParameters.HwndSourceHook = ApplicationMessageFilter;
HwndSource source = new HwndSource(sourceParameters);
source.RootVisual = chart;
}
chart.Save("Chart.png");
} |