/// <summary> /// Handles changes to the AutoTabOnMaxLength 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 OnAutoTabOnMaxLengthChanged( DependencyObject d, DependencyPropertyChangedEventArgs e) { bool newAutoTabOnMaxLength = (bool)d.GetValue(AutoTabOnMaxLengthProperty); var handler = GetAutoTabOnMaxLengthHandler(d); if (handler != null) { handler.Detach(); SetAutoTabOnMaxLengthHandler(d, null); } if (newAutoTabOnMaxLength) { handler = new AutoTabOnMaxLengthHandler((TextBox)d); SetAutoTabOnMaxLengthHandler(d, handler); } }
public static void SetAutoTabOnMaxLengthHandler(DependencyObject d, AutoTabOnMaxLengthHandler value) { d.SetValue(AutoTabOnMaxLengthHandlerProperty, value); }