SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components


I have an application that has a MainWindow that launches new ChartWindows (contains SciChart code) when you click a button. Each ChartWindow is launched on a new thread to avoid UI freezes. Also each one of the windows has a background thread that received live data from the exchange and updates the chart. Everything was working fine on version 1.7, but then I decided to update version 2.1.1 this week and that’s when the issues started.

After I open my first ChartWindow and try opening a new one I get a XmalParseException (see attached picture and exception.txt file). The only changed I made besided replacing the .dll file was updating the way DataSeries are created on the v2.

I am attaching the .cs and .xaml file for my ChartWindow, and this is the code I use to launch those windows:

    private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        Thread thread = new Thread(() =>
            ChartWindow w = new ChartWindow();

            w.Closed += (sender2, e2) =>



Besides that code, there is nothing else in the MainWindow.xaml.cs.

As I said before this was working fine on v1.7 (the code for v1.7 is still there but commented).

I appreciate any help I can get, thanks.

  • You must to post comments

Hi dguerrero,

Do you have a source code license? The reason why SciChart is throwing when launched on different threads is in v2.x we share a single set of Control Templates for all charts, and themes are bound statically to a ThemeManager. This has resulted in huge performance increases in the WPF elements of the chart since we are not creating and maintaining templates per chart instance.

This isn’t something which we can just change, we’ve actively made changes to move toward a shared template model in v2.x. However as a workaround you could apply new templates to each chart that is shown. It would require some work – taking the code in Default.xaml in our source solution and applying them with theme colours to a resource dictionary for each new SciChart that you create.

My final question is as follows: I realise its is a genuine use case to pop windows up on different threads in WPF applications, however I’ve always thought if you need more than one UI thread, there is fundamentally a design flaw with the software somewhere. Ideally the UI thread should be doing as little as possible and all work on a background thread. Now SciChart renders on the UI Thread (currently) but now in v2.x that almost all drawing is done in a bitmap (Everything except axis labels), we are working to move it off into parallel Tasks, to free up the UI. Would that be a viable alternative?

Best regards,

  • Diego Guerrero
    Hi Andrew! Regarding your first question I don't have a source code license, so does that mean that I cannot apply your workaround? Is there another possible solution? About your last remark, I haven't done a lot of multi-threading development before, so I'm kind of learning on the go right now, therefore any suggestion from someone with more experience is more than welcome. I'm not sure if I am understanding you correctly, so let me ask you: Are you suggesting me to run all charts on the same UI thread? Because that is something I can do for sure. Is there going to be an issue if I am running a lot of charts at the same time (20+)? Look forward to hearing from you. Best, Diego
  • Andrew Burnett-Thompson
    Hi Diego, If you are using SciChart v2.x you will have to have your chart windows on the same thread. That does not mean you cannot fetch, compute and append data on a background thread, that is fine. Just the trick of creating a new Dispatcher per Window will conflict with the shared Theme model that SciChart has. Give us some time we'll have a think and see if we can bring this behaviour back without sacrificing performance elsewhere. My ideal solution is for SciChart itself to do the multithreading in the render pipeline internally :-) Best regards, Andrew
  • Diego Guerrero
    Hi Andrew! Thanks for the reply. My charts are not very data heavy (at least not for now), so I don't think having all the charts on the same UI thread should be a problem. I will try this solution in the meantime. If you guys come up with a better solution or a different workaround let me know. Thanks a lot. Diego
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.