private static void OnMaximumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { SpinControl spinControl = d as SpinControl; if (spinControl != null) { spinControl.OnMaximumChanged((uint)e.NewValue); } }
private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { SpinControl spinControl = d as SpinControl; if (spinControl != null) { uint value = (uint)e.NewValue; if (value < spinControl.Minimum) { spinControl.Value = spinControl.Minimum; } else if (value > spinControl.Maximum) { spinControl.Value = spinControl.Maximum; } else { RoutedPropertyChangedEventArgs <uint> e2 = new RoutedPropertyChangedEventArgs <uint>((uint)e.OldValue, value, ValueChangedEvent); spinControl.OnValueChanged(e2); } } }