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



I have a scichart surface defined in xaml like this,

<local:SciChartSurface x:Name="_ChartSurface"  Annotations="{Binding ChartAnnotations}">


In the code behind I have ChartAnnotations defined as,

 public const string ChartAnnotationsPropertyName = "ChartAnnotations";
        private AnnotationCollection _ChartAnnotations = new AnnotationCollection();
        public AnnotationCollection ChartAnnotations
            get { return _ChartAnnotations; }
                if (_ChartAnnotations == value)

                _ChartAnnotations = value;

 public ViewModelExample()
  ChartAnnotations.CollectionChanged += ChartAnnotations_CollectionChanged;    

 void ChartAnnotations_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)

Than in the code behind, I just initialize and add some annotations to the ChartAnnotations collection to populate my chart. The problem is that my Annotations property on the scichart surface is still null, and the RaisePropertyChanged() is not affecting the Bindings at all. I’m certain that the DataContext is set right as other stuff in the graph works fine. I works when I explicitly set the surface’s Annotations property with my ChartAnnotations collection, but obviously this is less than ideal.

Is there an additional step that I’m missing here?


  • You must to post comments
Great Answer

Hi Kewur,

I don’t understand why the AnnotationsCollection is null. This is set in the constructor of the SciChartSurface, so, unless you are setting it to null (possibly via a bad binding? Or binding to a property which has a null value) it should never be null.

Perhaps this alone helps your investigation, but also I wanted to point you to this article on Editing Annotations and keeping track of them in an MVVM application, which describes the proper MVVM architecture to adopt when using Annotations in an MVVM WPF application.

Best regards,

  • kewur
    Hi Andrew, Thanks for the help, I was able to get it running by calling InitializeComponent() after I set the annotations, instead of before. Hope this helps someone else. Thanks
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

SciChart WPF v6 BETA released! Note pricing/licensing changes are coming. Contact us to beat the rise!Read more