1 //----------------------------------------------------------------
2 // <copyright company="Microsoft Corporation">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 //----------------------------------------------------------------
7 namespace System.Activities.Presentation.Model
11 internal class AttachablePropertyChange : ModelChange
13 public ModelItem Owner { get; set; }
15 public AttachableMemberIdentifier AttachablePropertyIdentifier { get; set; }
17 public object OldValue { get; set; }
19 public object NewValue { get; set; }
21 public string PropertyName { get; set; }
23 public override string Description
25 get { return SR.PropertyChangeEditingScopeDescription; }
28 public override bool Apply()
30 if (this.NewValue == null)
32 AttachablePropertyServices.RemoveProperty(this.Owner.GetCurrentValue(), this.AttachablePropertyIdentifier);
36 AttachablePropertyServices.SetProperty(this.Owner.GetCurrentValue(), this.AttachablePropertyIdentifier, this.NewValue);
40 if (!string.IsNullOrEmpty(this.PropertyName))
42 ((IModelTreeItem)this.Owner).OnPropertyChanged(this.PropertyName);
48 public override Change GetInverse()
50 return new AttachablePropertyChange()
53 AttachablePropertyIdentifier = this.AttachablePropertyIdentifier,
54 OldValue = this.NewValue,
55 NewValue = this.OldValue,
56 PropertyName = this.PropertyName