public override void Reset() { UndoService undoService = _designItem.Services.GetService <UndoService>(); if (undoService != null) { undoService.Execute(new PropertyChangeAction(this, null, false)); } else { ResetInternal(); } }
void Execute(ITransactionItem item) { UndoService undoService = context.Services.GetService <UndoService>(); if (undoService != null) { undoService.Execute(item); } else { item.Do(); } }
public override void SetValue(object value) { XamlPropertyValue newValue; if (value == null) { newValue = _property.ParentObject.OwnerDocument.CreateNullValue(); } else { XamlComponentService componentService = _designItem.ComponentService; XamlDesignItem designItem = value as XamlDesignItem; if (designItem == null) { designItem = (XamlDesignItem)componentService.GetDesignItem(value); } if (designItem != null) { if (designItem.Parent != null) { throw new DesignerException("Cannot set value to design item that already has a parent"); } newValue = designItem.XamlObject; } else { XamlPropertyValue val = _property.ParentObject.OwnerDocument.CreatePropertyValue(value, _property); designItem = componentService.RegisterXamlComponentRecursive(val as XamlObject); newValue = val; } } UndoService undoService = _designItem.Services.GetService <UndoService>(); if (undoService != null) { undoService.Execute(new PropertyChangeAction(this, newValue, true)); } else { SetValueInternal(newValue); } }