public void OnValueChanging(ExtendPropertyValueChangingArgs args) { if (ValueChanging != null) { ValueChanging(this, args); } }
public virtual void SetValue(ExtendProperty property, object value) { var changingItemArgs = new ExtendPropertyValueChangingArgs() { Value = value, Item = GetOwner(), PropertyType = property.PropertyType, PropertyName = property.PropertyName, Cancel = false }; property.OnValueChanging(changingItemArgs); if (!changingItemArgs.Cancel) { var changedItemArgs = new ExtendPropertyValueChangedArgs(); int propertyHash = property.GetHashCode(); int key = this.GetHashCode() ^ propertyHash; if (propertyValues.Keys.Any(k => k == key)) { changedItemArgs.OldValue = propertyValues[key]; propertyValues[key] = value; } else { changedItemArgs.OldValue = null; propertyValues.TryAdd(key, value); } changedItemArgs.Item = GetOwner(); changedItemArgs.PropertyType = property.PropertyType; changedItemArgs.PropertyName = property.PropertyName; changedItemArgs.NewValue = value; changedItemArgs.PropertyInfo = property; property.OnValueChanged(changedItemArgs); OnPropertyChanged(property); //OnChildrenPropertyChanged(changedItemArgs); } }
public void OnValueChanging(ExtendPropertyValueChangingArgs args) { if (ValueChanging != null) ValueChanging(this, args); }