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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

0
0

Hey guys,

I have been working on an application (with an internal library for building plots, and an adapter that creates the SciChart ViewModel implementation). All of my code makes heavy use of .Net 4.5’s Async API.

What I’ve noticed is that invoking the constructor on a RenderableSeries without the Dispatcher triggers the STA InvalidOperationException in PresentationCore. (Note that this is all happening during ViewModel construction, and before any changes have been made to the UI).

Is there any guidance on which parts of the SciCharts API require use of the UI thread?

  • You must to post comments
0
0

Hi there,

RenderableSeries are indeed FrameworkElements and need to be instantiated on the UI thread. I would suggest do this create a factory class which you can inject into your ViewModels via dependency injection. The factory should also have the application dispatcher (given at startup, or in a bootstrapper if you are using a framework such as Prism). That way your viewmodels work at runtime and remain testable at test-time.

By the way if you want to see the base classes for types in the SciChart library, take a look at our online documentation which details the class hierarchy.

Hope this helps!

Andrew

  • dsantimore
    Thanks. That was quick! I won't be implementing things in this way (I'm avoiding DI in this project) but it helps to know that you can't invoke a FrameworkElement's constructor without being on the UI thread (something new every day... ).
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.