void SetPropertyValue(XamlPropertyValue value) { // Binding... //if (IsCollection) { // throw new InvalidOperationException("Cannot set the value of collection properties."); //} bool wasSet = this.IsSet; PossiblyNameChanged(propertyValue, value); //reset expression var xamlObject = propertyValue as XamlObject; if (xamlObject != null && xamlObject.IsMarkupExtension) { propertyInfo.ResetValue(parentObject.Instance); } ResetInternal(); propertyValue = value; if (propertyValue != null) { propertyValue.ParentProperty = this; propertyValue.AddNodeTo(this); } UpdateValueOnInstance(); ParentObject.OnPropertyChanged(this); if (!wasSet) { if (IsSetChanged != null) { IsSetChanged(this, EventArgs.Empty); } } if (ValueChanged != null) { ValueChanged(this, EventArgs.Empty); } }