/// <summary> /// Handles changes to the ButtonStateEventBehavior property. /// </summary> /// <param name="d"> /// The <see cref="DependencyObject"/> on which /// the property has changed value. /// </param> /// <param name="e"> /// Event data that is issued by any event that /// tracks changes to the effective value of this property. /// </param> private static void OnButtonStateEventBehaviorChanged( DependencyObject d, DependencyPropertyChangedEventArgs e) { ButtonStateEventBehavior oldButtonStateEventBehavior = (ButtonStateEventBehavior)e.OldValue; ButtonStateEventBehavior newButtonStateEventBehavior = (ButtonStateEventBehavior)d.GetValue(ButtonStateEventBehaviorProperty); if (oldButtonStateEventBehavior != null) { oldButtonStateEventBehavior.Detach(); } if (newButtonStateEventBehavior != null) { newButtonStateEventBehavior.Attach((ButtonBase)d); } }
/// <summary> /// Sets the ButtonStateEventBehavior property. This dependency property /// indicates the behavior that allows to handle button Up/Down event handling. /// </summary> public static void SetButtonStateEventBehavior(DependencyObject d, ButtonStateEventBehavior value) { d.SetValue(ButtonStateEventBehaviorProperty, value); }