I have two lightningchart components in my view, My goal is to have a viewXY view in each one of them and bind the XAxes of those two charts to a XAxisObservableCollection object in my viewModel, so even when I try to bind one of the XAxes components I get the following error in my designer:
My View Code is:NullReferenceException: Object reference not set to an instance of an object.
Stack Trace:
at Arction.WPF.LightningChartUltimate.Views.ViewXY.ViewXY.IYB()
at Arction.WPF.LightningChartUltimate.LightningChartUltimate.KZB()
at Arction.WPF.LightningChartUltimate.LightningChartUltimate.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
at System.Windows.ContextLayoutManager.fireSizeChangedEvents()
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.UIElement.UpdateLayout()
InnerException: None
Code: Select all
<lcu:LightningChartUltimate x:Name="chartTop" Content="LightningChartUltimate" Grid.Row="0">
<lcu:LightningChartUltimate.ViewXY>
<lcu:ViewXY YAxes="{Binding MainXAxes}"/>
</lcu:LightningChartUltimate.ViewXY>
</lcu:LightningChartUltimate>
Code: Select all
public ViewModel() : base(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name) //Constructor
{
MainXAxes = new Arction.WPF.LightningChartUltimate.Views.ViewXY.XAxisObservableCollection();
Arction.WPF.LightningChartUltimate.Axes.AxisX AX = new Arction.WPF.LightningChartUltimate.Axes.AxisX();
MainXAxes.Add(AX);
}
private Arction.WPF.LightningChartUltimate.Views.ViewXY.XAxisObservableCollection mainXAxes;
public Arction.WPF.LightningChartUltimate.Views.ViewXY.XAxisObservableCollection MainXAxes
{
get
{
return mainXAxes;
}
set { mainXAxes = value; RaisePropertyChangedEvent("MainXAxes"); }
}
System.NullReferenceException was unhandled
Message: An unhandled exception of type 'System.NullReferenceException' occurred in Arction.WPF.LightningChartUltimate.dll
Additional information: Object reference not set to an instance of an object.
What am I missing??! I would appreciate any help. Thank you in advance and let me know if you need any more information about my problem.