Pre loader

SciChart and WPF STA

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

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.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies