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


How to programmatically add Scrollbars to MVVM instantiated axes?

I added DateTimeAxisViewModel and NumericAxisViewModel to my code. That works from so far. A way to add scrollbars i couldnt find a some tries.

Are there some ways to get this done? Maybe change the templates of the axes or the chart?

Best regards

  • You must to post comments

That’s a good question,

We don’t have a mechanism to do it built in to the API, but you could quite easily write a custom style to enable scrollbars on the axis in MVVM.

I have created an example for you and uploaded to our Sandbox on github.

The sample is found at Sandbox/UsefulExamples/Examples/ScrollbarMvvmAxis/ScrollbarMvvmAxis.xaml

Best regards,

  • You must to post comments

SciChart SDK – SC-WPF-SDK-PRO Trial

Thank you for the quick response. But i am afraid i am still stuck.

A very exact replication of the example integrated in my code, throws “Unable to cast object of type ‘System.String’ to type ‘System.Windows.Style’.” exception. It isnt catched and crashes to the unhandled exception event handler.

For the custom numeric it is like that and if i step past the exception the style is applied. For DateTimeAxis is isnt working like that at all. Instead directly followed with an: “System.InvalidOperationException”, like “The application is already execution the dispatcher” .

That first unhandeld exception can’t be good anyway.

Maybe because i declare the SciChartSurface in a DataTemplate?
Maybe it is an interaction with the Xceed WPF Tools Avalon Dock?

  • Andrew Burnett-Thompson
    Hi Alex, have you ever tried to debug code without seeing it? It’s hard :D Show us what’s going wrong and what you have tried and maybe we can try to help
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.