예제 #1
0
 void pinImage_RadPropertyChanged(object sender, Telerik.WinControls.RadPropertyChangedEventArgs e)
 {
     if (e.Property == ContainsMouseProperty)
     {
         AdjustVisibility();
     }
 }
예제 #2
0
 protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
 {
     if (e.Property == VisualElement.FontProperty)
     {
         this.OnFontChanged(EventArgs.Empty);
     }
     else if (e.Property == VisualElement.CustomFontProperty || e.Property == VisualElement.CustomFontSizeProperty || e.Property == VisualElement.CustomFontStyleProperty)
     {
         FontFamily family     = (FontFamily)null;
         string     customFont = this.CustomFont;
         if (!string.IsNullOrEmpty(customFont) && customFont != "None")
         {
             family = ThemeResolutionService.GetCustomFont(customFont);
         }
         if (family == null)
         {
             int num = (int)this.ResetValue(VisualElement.FontProperty, ValueResetFlags.DefaultValueOverride);
             return;
         }
         if (!string.IsNullOrEmpty(customFont))
         {
             int num1 = (int)this.SetDefaultValueOverride(VisualElement.FontProperty, (object)new Font(family, this.CustomFontSize, this.CustomFontStyle));
         }
     }
     base.OnPropertyChanged(e);
 }
예제 #3
0
        protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
        {
            base.OnPropertyChanged(e);

            if (this.hostedControl == null)
            {
                return;
            }

            if (e.Property == VisualElement.ForeColorProperty)
            {
                this.SyncForeColor((Color)e.NewValue);
            }
            else if (e.Property == VisualElement.BackColorProperty)
            {
                SyncBackColor((Color)e.NewValue);
            }
            else if (e.Property == FontProperty)
            {
                this.SyncFont((Font)e.NewValue);
            }
            else if (e.Property == RightToLeftProperty)
            {
                this.SyncRTL((bool)e.NewValue);
            }
            else if (e.Property == RadElement.EnabledProperty)
            {
                this.hostedControl.Enabled = (bool)e.NewValue;
            }
        }
예제 #4
0
 protected virtual void OnStorageTypeChanged(RadPropertyChangedEventArgs e)
 {
     if (this.SettingsAreValid)
     {
         ReloadThemeFromStorage();
     }
 }
예제 #5
0
        protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
        {
            if (e.Property == FontProperty)
            {
                this.OnFontChanged(EventArgs.Empty);
            }
            else if (e.Property == StyleProperty)
            {
                //Logic moved to StyleManager
                ////unapply previous style
                //if (e.OldValue != null)
                //{
                //    ((StyleSheet)e.OldValue).Unapply(this);
                //}

                //if (e.NewValue != null)
                //{
                //    //apply new one, forbidding animations temporary
                //    AnimatedPropertySetting.AnimationsEnabled = false;

                //    StyleSheet style = (StyleSheet)e.NewValue;
                //    style.ProcessStyle(this);
                //    style.ApplyStyle(this);

                //    AnimatedPropertySetting.AnimationsEnabled = true;
                //}

                this.OnStyleChanged(e);
            }

            base.OnPropertyChanged(e);
        }
 public bool Equals(RadPropertyChangedEventArgs args)
 {
     if (this._property == args._property && this._metadata == args._metadata && (this._oldValue == args._oldValue && this._newValue == args._newValue) && (this._isASubPropertyChange == args._isASubPropertyChange && this._isOldValueDeferred == args._isOldValueDeferred && (this._isNewValueDeferred == args._isNewValueDeferred && this._oldValueSource == args._oldValueSource)))
     {
         return(this._newValueSource == args._newValueSource);
     }
     return(false);
 }
        public override void OnPropertyChange(RadElement element, RadPropertyChangedEventArgs e)
        {
            /*VisualElement visualElement = element as VisualElement;
             * if (visualElement == null)
             *  return;*/

            selector.Apply(element, propertySettings);
        }
예제 #8
0
 protected override void OnDisplayPropertyChanged(RadPropertyChangedEventArgs e)
 {
     if (!this.IsInValidState(true))
     {
         return;
     }
     this.ElementTree.ComponentTreeHandler.OnDisplayPropertyChanged(e);
     base.OnDisplayPropertyChanged(e);
 }
예제 #9
0
        protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
        {
            base.OnPropertyChanged(e);

            if (e.Property == BindingContextProperty)
            {
                UpdateBindings(e);
            }
        }
예제 #10
0
 protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
 {
     base.OnPropertyChanged(e);
     if (e.Property != RadObject.BindingContextProperty)
     {
         return;
     }
     this.UpdateBindings(e);
 }
예제 #11
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);
        }
예제 #12
0
        private static void OnStorageTypeChanged(RadObject d, RadPropertyChangedEventArgs e)
        {
            ThemeSource themeSource = (ThemeSource)d;

            if (!themeSource.SettingsAreValid)
            {
                return;
            }
            themeSource.ReloadThemeFromStorage();
        }
예제 #13
0
        protected virtual void OnPropertyChanged(RadPropertyChangedEventArgs e)
        {
            RadPropertyChangedEventHandler changedEventHandler = this.Events[RadObject.RadPropertyChangedEventKey] as RadPropertyChangedEventHandler;

            if (changedEventHandler != null)
            {
                changedEventHandler((object)this, e);
            }
            this.OnNotifyPropertyChanged(new PropertyChangedEventArgs(e.Property.Name));
        }
예제 #14
0
 private void UpdateBindings(RadPropertyChangedEventArgs e)
 {
     if (e.Property == RadObject.BindingContextProperty)
     {
         for (int i = 0; i < this.DataBindings.Count; i++)
         {
             System.Windows.Forms.BindingContext.UpdateBinding(this.BindingContext, this.DataBindings[i]);
         }
     }
 }
예제 #15
0
 private void UpdateBindings(RadPropertyChangedEventArgs e)
 {
     if (e.Property != RadObject.BindingContextProperty)
     {
         return;
     }
     for (int index = 0; index < this.DataBindings.Count; ++index)
     {
         BindingContext.UpdateBinding(this.BindingContext, this.DataBindings[index]);
     }
 }
예제 #16
0
        protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
        {
            if (e.Property == RadElement.BoundsProperty)
            {
                if (!this.UseNewLayoutSystem)
                {
                    if (this.AutoSize && this.AutoSizeMode == RadAutoSizeMode.FitToAvailableSize)
                    {
                        //this.Size = this.ElementTree.Control.Size;
                    }
                    else
                    {
                        this.ElementTree.ComponentTreeHandler.ElementTree.LockControlLayout();
                        this.ElementTree.Control.Size = ((Rectangle)e.NewValue).Size;
                        this.ElementTree.ComponentTreeHandler.ElementTree.UnlockControlLayout();
                    }
                }
                if ((this.Shape != null) && (this.formControl != null) &&
                    this.ApplyShapeToControl)
                {
                    Rectangle oldBounds = (Rectangle)e.OldValue;
                    Rectangle newBounds = (Rectangle)e.NewValue;
                    //change region only of the Size has changed
                    if (oldBounds.Size != newBounds.Size)
                    {
                        CreateRegionFromShape(newBounds.Size);
                    }
                }
            }
            else if ((e.Property == ShapeProperty) && this.ApplyShapeToControl)
            {
                ElementShape shape = e.NewValue as ElementShape;
                if ((shape != null) && (this.ElementTree != null))
                {
                    CreateRegionFromShape(this.Size);
                }
            }

            else if (e.Property == ApplyShapeToControlProperty)
            {
                if ((bool)e.NewValue && this.Shape != null)
                {
                    CreateRegionFromShape(this.Size);
                }
                else
                {
                    this.ElementTree.Control.Region = null;
                }
            }
            else
            {
                base.OnPropertyChanged(e);
            }
        }
예제 #17
0
        /// <summary>
        /// Raises the <see cref="PropertyChanged"/> event.
        /// </summary>
        /// <param name="e"></param>
        protected virtual void OnPropertyChanged(RadPropertyChangedEventArgs e)
        {
            RadPropertyChangedEventHandler handler = this.Events[RadPropertyChangedEventKey] as RadPropertyChangedEventHandler;

            if (handler != null)
            {
                handler(this, e);
            }

            //raise the standard .NET PropertyChanged event
            this.OnNotifyPropertyChanged(new PropertyChangedEventArgs(e.Property.Name));
        }
예제 #18
0
 public bool Equals(RadPropertyChangedEventArgs args)
 {
     return
         ((this._property == args._property) &&
          (this._metadata == args._metadata) &&
          (this._oldValue == args._oldValue) &&
          (this._newValue == args._newValue) &&
          (this._isASubPropertyChange == args._isASubPropertyChange) &&
          (this._isOldValueDeferred == args._isOldValueDeferred) &&
          (this._isNewValueDeferred == args._isNewValueDeferred) &&
          (this._oldValueSource == args._oldValueSource) &&
          (this._newValueSource == args._newValueSource));
 }
예제 #19
0
 protected override void OnLayoutPropertyChanged(RadPropertyChangedEventArgs e)
 {
     if (e.Property == RadElement.StretchHorizontallyProperty || e.Property == RadElement.StretchVerticallyProperty)
     {
         IComponentTreeHandler componentTreeHandler = this.ElementTree.ComponentTreeHandler;
         if (componentTreeHandler != null)
         {
             componentTreeHandler.ElementTree.PerformLayout();
             return;
         }
     }
     base.OnLayoutPropertyChanged(e);
 }
예제 #20
0
 private void panelBar_RadPropertyChanged(object sender, Telerik.WinControls.RadPropertyChangedEventArgs e)
 {
     if (e.Property == RadItem.BoundsProperty ||
         e.Property == RadPanelBarElement.TopOffsetProperty ||
         e.Property == RadPanelBarElement.RightOffsetProperty ||
         e.Property == RadPanelBarElement.SpacingBetweenGroupsProperty ||
         e.Property == RadPanelBarElement.SpacingBetweenColumnsProperty ||
         e.Property == RadPanelBarElement.NumberOfColumnsProperty ||
         e.Property == RadPanelBarElement.BottomOffsetProperty ||
         e.Property == RadPanelBarElement.LeftOffsetProperty ||
         e.Property == RadPanelBarElement.PanelBarStyleProperty)
     {
     }
 }
예제 #21
0
        protected override void OnBoundsChanged(RadPropertyChangedEventArgs e)
        {
            base.OnBoundsChanged(e);
            if (this.LayoutManager.IsUpdating)
            {
                return;
            }
            Control control = this.ElementTree.Control;

            if (control == null || !control.AutoSize)
            {
                return;
            }
            control.Size = this.Size;
        }
예제 #22
0
        protected override void OnLocationChanged(RadPropertyChangedEventArgs e)
        {
            base.OnLocationChanged(e);
            if (this.LayoutManager.IsUpdating)
            {
                return;
            }
            Control control = this.ElementTree.Control;

            if (control == null)
            {
                return;
            }
            control.Location = ((Rectangle)e.NewValue).Location;
        }
예제 #23
0
 protected override void OnLayoutPropertyChanged(RadPropertyChangedEventArgs e)
 {
     if (this.UseNewLayoutSystem)
     {
         if (e.Property == RadElement.StretchHorizontallyProperty || e.Property == RadElement.StretchVerticallyProperty)
         {
             IComponentTreeHandler ctl = this.ElementTree.ComponentTreeHandler;
             if (ctl != null)
             {
                 ctl.ElementTree.ResetSize();
                 return;
             }
         }
     }
     base.OnLayoutPropertyChanged(e);
 }
예제 #24
0
        protected override void OnBoundsChanged(RadPropertyChangedEventArgs e)
        {
            base.OnBoundsChanged(e);

            if (this.UseNewLayoutSystem)
            {
                if (!this.LayoutManager.IsUpdating)
                {
                    Control ctl = this.ElementTree.Control;
                    if (ctl != null && ctl.AutoSize)
                    {
                        // Set only Size here - OnLocationChanged() will set Location
                        ctl.Size = this.Size;
                    }
                }
            }
        }
예제 #25
0
        protected override void OnLocationChanged(RadPropertyChangedEventArgs e)
        {
            base.OnLocationChanged(e);

            if (this.UseNewLayoutSystem)
            {
                if (!this.LayoutManager.IsUpdating)
                {
                    Control ctl = this.ElementTree.Control;
                    if (ctl != null)
                    {
                        //old code
                        //ctl.Location = this.Location;

                        //FIXED: the location relationship between the rootradelement and the radcontrol when set through bounds
                        //WINF-10440
                        ctl.Location = ((Rectangle)e.NewValue).Location;
                    }
                }
            }
        }
예제 #26
0
 protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
 {
     if (e.Property == RadElement.BoundsProperty)
     {
         if (this.Shape == null || this.formControl == null || (!this.ApplyShapeToControl || !this.formControl.AllowTheming))
         {
             return;
         }
         Rectangle oldValue = (Rectangle)e.OldValue;
         Rectangle newValue = (Rectangle)e.NewValue;
         if (!(oldValue.Size != newValue.Size))
         {
             return;
         }
         this.CreateRegionFromShape(newValue.Size);
     }
     else if (e.Property == RadElement.ShapeProperty && this.ApplyShapeToControl)
     {
         if (!(e.NewValue is ElementShape) || this.ElementTree == null)
         {
             return;
         }
         this.CreateRegionFromShape(this.Size);
     }
     else if (e.Property == RootRadElement.ApplyShapeToControlProperty)
     {
         if ((bool)e.NewValue && this.Shape != null && this.formControl.AllowTheming)
         {
             this.CreateRegionFromShape(this.Size);
         }
         else
         {
             this.ElementTree.Control.Region = (Region)null;
         }
     }
     else
     {
         base.OnPropertyChanged(e);
     }
 }
예제 #27
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);
        }
예제 #28
0
 protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
 {
     base.OnPropertyChanged(e);
     if (this.hostedControl == null)
     {
         return;
     }
     if (e.Property == VisualElement.ForeColorProperty)
     {
         this.SyncForeColor((Color)e.NewValue);
     }
     else if (e.Property == VisualElement.BackColorProperty)
     {
         this.SyncBackColor((Color)e.NewValue);
     }
     else if (e.Property == VisualElement.FontProperty)
     {
         if (this.ElementState != ElementState.Loaded)
         {
             this.initValues["Font"] = (object)(Font)e.NewValue;
         }
         else
         {
             this.SyncFont((Font)e.NewValue);
         }
     }
     else if (e.Property == RadElement.RightToLeftProperty)
     {
         this.SyncRTL((bool)e.NewValue);
     }
     else
     {
         if (e.Property != RadElement.EnabledProperty)
         {
             return;
         }
         this.hostedControl.Enabled = (bool)e.NewValue;
         this.SyncBackColor(this.BackColor);
     }
 }
        internal void NotifyElementPropertyChanged(RadElement element, RadPropertyChangedEventArgs args)
        {
            ElementPropertyKey key = new ElementPropertyKey(element, args.Property);

            ElementRadPropertyChangedDelegate handler = this.elementPropertyChangeEventList[key];

            if (handler != null)
            {
                handler(element, args);
            }

            List <IPropertyChangeListener> changeListeners = GetPropertyChangeListeners(args.Property);

            if (changeListeners == null)
            {
                return;
            }

            for (int i = 0; i < changeListeners.Count; i++)
            {
                changeListeners[i].OnRadPropertyChanged(element, args);
            }
        }
예제 #30
0
        protected virtual void OnControlDefaultSizeChanged(RadPropertyChangedEventArgs e)
        {
            RadControl control = this.ElementTree.Control as RadControl;

            if (control == null || control.AutoSize)
            {
                return;
            }
            Size controlDefaultSize = control.GetControlDefaultSize();
            Size newValue           = (Size)e.NewValue;

            if (controlDefaultSize == control.Size || control.Size == Size.Empty)
            {
                control.Size = newValue;
            }
            else
            {
                if (control.Size.Height >= newValue.Height)
                {
                    return;
                }
                control.Height = newValue.Height;
            }
        }