diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlModelProperty.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlModelProperty.cs index d78e84bef0d..73e046a3821 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlModelProperty.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlModelProperty.cs @@ -132,7 +132,12 @@ public override string TextValue return null; } } - + + internal void SetValueOnInstance(object value) + { + _property.ValueOnInstance = value; + } + // There may be multiple XamlModelProperty instances for the same property, // so this class may not have any mutable fields / events - instead, // we forward all event handlers to the XamlProperty. @@ -195,13 +200,8 @@ public override string TextValue _property.IsSetChanged -= value; } } - + public override void SetValue(object value) - { - SetValue(value, false); - } - - private void SetValue(object value, bool withoutUndo) { XamlPropertyValue newValue; if (value == null) { @@ -223,7 +223,7 @@ private void SetValue(object value, bool withoutUndo) } UndoService undoService = _designItem.Services.GetService(); - if (undoService != null && !withoutUndo) + if (undoService != null) undoService.Execute(new PropertyChangeAction(this, newValue, true)); else SetValueInternal(newValue); @@ -308,12 +308,15 @@ public void Undo() } } else { - try { - property.SetValue(oldValueOnInstance, true); + if (property.DependencyProperty == null) { + try + { + property.SetValueOnInstance(oldValueOnInstance); + } + catch(Exception) + { } } - catch(Exception) - { } - + property.ResetInternal(); } }