static object OnRadiusCoerceCallback(DependencyObject obj, object value) { ACMButton @this = obj as ACMButton; @this._radiusTemp = (double)value; // Saving value to temporary variable for reset when FormType property was changed from square to circle. if (@this.FormType != ACMButtonForm.Circle) { return(0.0); } return(value); }
/// <summary> /// If Radius property is validation, then change width and height by force. /// </summary> static void OnRadiusPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) { ACMButton @this = obj as ACMButton; if (null != args.NewValue) { double newValue = (double)args.NewValue; @this.Width = newValue; @this.Height = newValue; } }
/// <summary> /// Refresh Radius value once FormType was changed. /// </summary> static void OnFormtypeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) { ACMButton @this = obj as ACMButton; ACMButtonForm forType = (ACMButtonForm)args.NewValue; if (forType == ACMButtonForm.Circle) { @this.Radius = @this._radiusTemp; } }
static object OnWithOrHeightCoerceCallback(DependencyObject obj, object value) { ACMButton @this = obj as ACMButton; switch (@this.FormType) { case ACMButtonForm.Square: return(value); case ACMButtonForm.Circle: return(@this.Radius); default: return(value); } }
static void OnProcessingPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) { ACMButton @this = obj as ACMButton; bool newValue = (bool)args.NewValue; if (newValue != true) { return; } @this.IsProcessStart = true; }