Ejemplo n.º 1
0
 protected override void OnPropertyChanging(RadPropertyChangingEventArgs args)
 {
     if (this.GetBitState(ForcingLocationStateKey) && args.Property == RadElement.BoundsProperty)
     {
         return;
     }
     base.OnPropertyChanging(args);
 }
Ejemplo n.º 2
0
 protected override void OnPropertyChanging(RadPropertyChangingEventArgs args)
 {
     if (this.GetBitState(281474976710656L) && args.Property == RadElement.BoundsProperty)
     {
         return;
     }
     base.OnPropertyChanging(args);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Raises the <see cref="RadPropertyChanging"/> event.
        /// </summary>
        /// <param name="args"></param>
        protected virtual void OnPropertyChanging(RadPropertyChangingEventArgs args)
        {
            RadPropertyChangingEventHandler handler = this.Events[RadPropertyChangingEventKey] as RadPropertyChangingEventHandler;

            if (handler != null)
            {
                handler(this, args);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Performs the following logic:
        /// 1. Compares oldValue and newValue and returns ValueUpdateResult.NotChanged if they are equal.
        /// 2. Raises the PropertyChanging notification. If the event is canceled returns ValueUpdateResult.Canceled.
        /// 3. Raises PropertyChanged notification and returns ValueUpdateResult.Updated.
        /// </summary>
        /// <param name="propVal"></param>
        /// <param name="oldValue"></param>
        /// <param name="newValue"></param>
        /// <param name="oldSource"></param>
        /// <returns>The result of the operation.</returns>
        internal ValueUpdateResult RaisePropertyNotifications(RadPropertyValue propVal, object oldValue, object newValue, ValueSource oldSource)
        {
            if (!this.CanRaisePropertyChangeNotifications(propVal))
            {
                return(ValueUpdateResult.NotUpdated);
            }

            //in some cases we may run into composite property update and property notifications will not be needed.
            if (propVal.IsCompositionLocked)
            {
                return(ValueUpdateResult.Updating);
            }

            //compare the new value of the property with its previous one
            if (object.Equals(oldValue, newValue))
            {
                //current property value has not changed, do not raise notifications
                return(ValueUpdateResult.UpdatedNotChanged);
            }

            RadPropertyChangingEventArgs changingArgs = new RadPropertyChangingEventArgs(propVal.Property, oldValue, newValue, propVal.Metadata);

            this.OnPropertyChanging(changingArgs);

            ValueUpdateResult result;

            if (changingArgs.Cancel)
            {
                result = ValueUpdateResult.Canceled;
            }
            else
            {
#if DEBUG
                //Validate needed conditions to update the property
                //TODO: This is currently performed during debug cycle, may be it should be done in release also
                EnsurePropertySet(propVal, newValue);
#endif
                //change is accepted, fire changed notification
                RadPropertyChangedEventArgs changedArgs = new RadPropertyChangedEventArgs(propVal.Property, propVal.Metadata, oldValue, newValue, false, false, oldSource, propVal.ValueSource);
                this.OnPropertyChanged(changedArgs);

                //notify all objects bound to the property we have just updated
                propVal.NotifyBoundObjects();

                //use the metadata callback if specified
                if (propVal.Metadata.PropertyChangedCallback != null)
                {
                    propVal.Metadata.PropertyChangedCallback(this, changedArgs);
                }

                //value was successfully updated
                result = ValueUpdateResult.UpdatedChanged;
            }

            return(result);
        }
Ejemplo n.º 5
0
        protected virtual void OnPropertyChanging(RadPropertyChangingEventArgs args)
        {
            RadPropertyChangingEventHandler changingEventHandler = this.Events[RadObject.RadPropertyChangingEventKey] as RadPropertyChangingEventHandler;

            if (changingEventHandler == null)
            {
                return;
            }
            changingEventHandler((object)this, args);
        }
Ejemplo n.º 6
0
        internal ValueUpdateResult RaisePropertyNotifications(
            RadPropertyValue propVal,
            object oldValue,
            object newValue,
            ValueSource oldSource)
        {
            if (!this.CanRaisePropertyChangeNotifications(propVal))
            {
                return(ValueUpdateResult.NotUpdated);
            }
            if (propVal.IsCompositionLocked)
            {
                return(ValueUpdateResult.Updating);
            }
            if (object.Equals(oldValue, newValue))
            {
                return(ValueUpdateResult.UpdatedNotChanged);
            }
            RadPropertyChangingEventArgs args = new RadPropertyChangingEventArgs(propVal.Property, oldValue, newValue, propVal.Metadata);

            this.OnPropertyChanging(args);
            ValueUpdateResult valueUpdateResult;

            if (args.Cancel)
            {
                valueUpdateResult = ValueUpdateResult.Canceled;
            }
            else
            {
                RadPropertyChangedEventArgs e = new RadPropertyChangedEventArgs(propVal.Property, propVal.Metadata, oldValue, newValue, false, false, oldSource, propVal.ValueSource);
                this.OnPropertyChanged(e);
                propVal.NotifyBoundObjects();
                if (propVal.Metadata != null && propVal.Metadata.PropertyChangedCallback != null)
                {
                    propVal.Metadata.PropertyChangedCallback(this, e);
                }
                valueUpdateResult = ValueUpdateResult.UpdatedChanged;
            }
            return(valueUpdateResult);
        }