예제 #1
0
 public void OnValueChanging(ExtendPropertyValueChangingArgs args)
 {
     if (ValueChanging != null)
     {
         ValueChanging(this, args);
     }
 }
예제 #2
0
        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);
            }
        }
예제 #3
0
 public void OnValueChanging(ExtendPropertyValueChangingArgs args)
 {
     if (ValueChanging != null)
         ValueChanging(this, args);
 }