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
- Alexander Buhles asked 7 years ago
- You must login 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,
Andrew
- Andrew Burnett-Thompson answered 7 years ago
- You must login to post comments
SciChart SDK 5.1.1.11473 – 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?
- Alexander Buhles answered 7 years ago
- 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 login to post comments
I am trying to add Scrollbars to MVVM instantiated axes now and found this Q&A. Is there an updated way of doing this now? I found that by just setting a few properties to the axis will create the exception Alex saw in the Sand Box project. For example, just adding AxisAlignment to the axis creation will break the scrollbar example:
YAxes.Add(new NumericAxisViewModelWithScrollbar() { HasScrollbar = true, StyleKey = “ScrollbarAxisStyle”, AxisAlignment = AxisAlignment.Left});
Any suggestions?
Thanks
Ning
- Ning Qiang answered 2 years ago
- last edited 2 years ago
- You must login to post comments
Please login first to submit.