Hi,
I am using Scichart 6.1 in WPF application. I want to access ScichartSurface in my view model to call some commands like ZoomExtentsModifier or SuspandUpdate. So I created all controls like surface, Axis, Series and annotations in my code according to your example ‘Creating your First SciChartSurface’.
My question is how can I attach this view model to my view [*.xaml file] ? I couldn’t find any example of xaml file in this case.
Regards
- maryam erfan asked 4 years ago
- You must login to post comments
Hi Maryam,
Without seeing the code it’s very difficult to offer some advice.
Firstly you don’t need to create a SciChartSurface in code to access ZoomExtents() or SuspendUpdates() in a view model. Instead you can use this technique or alternatively this technique to call SuspendUpdates.
You can also use this technique to call ZoomExtents form a ViewModel.
Let me know if this helps,
Best regards,
Andrew
- Andrew Burnett-Thompson answered 4 years ago
- You must login to post comments
Hi Andrew,
I am working on a pretty large application witch I want to replace another chart with Scichart. So, I really need to create Scicharturface in my code because I need to create custom theme, pass surface to my toolbox, call commands like SuspendUpdates or ZoomExtentsCommand. I’ll show you a piece of my work.
Here is my viewmodel:
public class ChartAreaViewModel : BaseModel
{
private SciChartSurface _parentSurface;
public SciChartSurface ParentSurface
{
get
{
return _parentSurface;
}
set
{
_parentSurface = value;
NotifyPropertyChanged(nameof(ParentSurface));
}
}
public ChartAreaViewModel()
{
ParentSurface = new SciChartSurface();
ParentSurface.YAxes = new SciChart.Charting.Model.AxisCollection();
ParentSurface.RenderableSeries = new ObservableCollection<IRenderableSeries>();
for (int i = 0; i < 5; i++)
{
FastLineRenderableSeries chart = new FastLineRenderableSeries();
ParentSurface.RenderableSeries.Add(chart);
}
}
}
And this is my view:
<UserControl x:Class="MyApp.Views.UserControls.ChartAreaView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:sci="http://schemas.abtsoftware.co.uk/scichart">
<Grid DataContext="{Binding ChartAreaViewModel}">
</Grid>
</UserControl>
How can I connect this surface from the view model to the view? Is it necessary to create SichartSurface in view again?
Thanks
- maryam erfan answered 4 years ago
- You must login to post comments
Please login first to submit.