/// <summary>
 /// The annotation data collection is changed.
 /// </summary>
 private void dataCollection_Changed(object sender, CollectionChangeEventArgs <AnnotationData> e)
 {
     // if annotation has been added to the collection
     if (e.Action == CollectionChangeActionType.InsertItem || e.Action == CollectionChangeActionType.SetItem)
     {
         AnnotationDataCollection dataCollection = (AnnotationDataCollection)sender;
         AnnotationViewCollection viewCollection = _annotationViewer.AnnotationViewController.GetAnnotationsView(dataCollection);
         // subscribe to the annotation view events
         SubscribeToAnnotationViewEvents(viewCollection.FindView(e.NewValue));
     }
     if (_isEnabled)
     {
         OnDataCollectionChanged((AnnotationDataCollection)sender, e);
     }
 }
        /// <summary>
        /// Unsubscribes from <see cref="AnnotationDataCollection"/> events.
        /// </summary>
        /// <param name="dataCollection">The annotation data collection.</param>
        private void UnubscribeFromAnnotationDataCollectionEvents(AnnotationDataCollection dataCollection)
        {
            if (_handleViewEvents)
            {
                AnnotationViewCollection viewCollection = _annotationViewer.AnnotationViewController.GetAnnotationsView(dataCollection);
                foreach (AnnotationView view in viewCollection)
                {
                    UnsubscribeFromAnnotationViewEvents(view);
                }
            }

            if (_handleDataEvents)
            {
                dataCollection.ItemPropertyChanging -= new EventHandler <AnnotationDataPropertyChangingEventArgs>(dataCollection_ItemPropertyChanging);
                dataCollection.ItemPropertyChanged  -= new EventHandler <AnnotationDataPropertyChangedEventArgs>(dataCollection_ItemPropertyChanged);
            }

            dataCollection.Changing -= new CollectionChangeEventHandler <AnnotationData>(dataCollection_Changing);
            dataCollection.Changed  -= new CollectionChangeEventHandler <AnnotationData>(dataCollection_Changed);
        }