private static void OnValueChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) { NumericUpDown nudCtrl = (NumericUpDown)obj; decimal oldValue = (decimal)args.OldValue; decimal newValue = (decimal)args.NewValue; #region Fire Automation events //<SnippetRaiseEventFromControl> if (AutomationPeer.ListenerExists(AutomationEvents.PropertyChanged)) { NumericUpDownAutomationPeer peer = UIElementAutomationPeer.FromElement(nudCtrl) as NumericUpDownAutomationPeer; if (peer != null) { peer.RaisePropertyChangedEvent( RangeValuePatternIdentifiers.ValueProperty, (double)oldValue, (double)newValue); } } //</SnippetRaiseEventFromControl> #endregion RoutedPropertyChangedEventArgs <decimal> e = new RoutedPropertyChangedEventArgs <decimal>( oldValue, newValue, ValueChangedEvent); nudCtrl.OnValueChanged(e); nudCtrl.updateValueString(); }
private static void OnValueChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) { NumericUpDown control = (NumericUpDown)obj; RoutedPropertyChangedEventArgs <decimal> e = new RoutedPropertyChangedEventArgs <decimal>( (decimal)args.OldValue, (decimal)args.NewValue, ValueChangedEvent); control.OnValueChanged(e); }