wpf can't bind XAxisObservableCollection to ViewModel

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

Posts: 1
Joined: Sat Feb 04, 2017 12:39 pm

wpf can't bind XAxisObservableCollection to ViewModel

Post by vahidnateghi » Sat Feb 04, 2017 12:57 pm

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:
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
My View Code is:

Code: Select all

            <lcu:LightningChartUltimate x:Name="chartTop" Content="LightningChartUltimate" Grid.Row="0">
                    <lcu:ViewXY YAxes="{Binding MainXAxes}"/>
My ViewModel Code is:

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();

        private Arction.WPF.LightningChartUltimate.Views.ViewXY.XAxisObservableCollection mainXAxes;
        public Arction.WPF.LightningChartUltimate.Views.ViewXY.XAxisObservableCollection MainXAxes
                return mainXAxes;
            set { mainXAxes = value; RaisePropertyChangedEvent("MainXAxes"); }
And when I try to run my program, I get a NullRefrenceException from LightningChartUltimate.dll :
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.

User avatar
Posts: 1366
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: wpf can't bind XAxisObservableCollection to ViewModel

Post by ArctionPasi » Sun Feb 05, 2017 12:08 pm


you didn't indicate which version you use, but based on namespace, it is some v.6.xxx?

Binding is supported in


namespaces of v.7.
LightningChart Support Team, PT