internal void Initialize(EditingContext editingContext, ScrollViewer scrollViewer)
        {
            this.scrollViewer = scrollViewer;
            this.enabled      = editingContext.Services.GetService <DesignerConfigurationService>().AnnotationEnabled;

            if (!this.enabled)
            {
                return;
            }

            AttachedPropertiesService attachedPropertiesService = editingContext.Services.GetService <AttachedPropertiesService>();
            AttachedProperty <string> attachedProperty          = new AttachedProperty <string>
            {
                IsBrowsable          = false,
                IsVisibleToModelItem = true,
                Name      = Annotation.AnnotationTextPropertyName,
                OwnerType = typeof(object),
                Getter    = (modelItem) =>
                {
                    string annotation = null;
                    AttachablePropertyServices.TryGetProperty <string>(modelItem.GetCurrentValue(), Annotation.AnnotationTextProperty, out annotation);
                    return(annotation);
                },
                Setter = (modelItem, value) =>
                {
                    string oldValue = null;
                    AttachablePropertyServices.TryGetProperty <string>(modelItem.GetCurrentValue(), Annotation.AnnotationTextProperty, out oldValue);
                    if (oldValue == value)
                    {
                        return;
                    }

                    ModelTreeManager treeManager = modelItem.GetEditingContext().Services.GetService <ModelTreeManager>();

                    AttachablePropertyChange change = new AttachablePropertyChange()
                    {
                        Owner = modelItem,
                        AttachablePropertyIdentifier = Annotation.AnnotationTextProperty,
                        OldValue     = oldValue,
                        NewValue     = value,
                        PropertyName = Annotation.AnnotationTextPropertyName
                    };

                    treeManager.AddToCurrentEditingScope(change);
                }
            };

            attachedPropertiesService.AddProperty(attachedProperty);
        }
        public override void StoreViewStateWithUndo(ModelItem modelItem, string key, object value)
        {
            object          oldValue = RetrieveViewState(modelItem, key);
            ViewStateChange vsChange = new ViewStateChange(this)
            {
                Item     = modelItem,
                Key      = key,
                OldValue = oldValue,
                NewValue = value,
            };
            ModelTreeManager modelTreeManager = this.context.Services.GetService <ModelTreeManager>();

            if (modelTreeManager != null)
            {
                modelTreeManager.AddToCurrentEditingScope(vsChange);
            }
        }