Esempio n. 1
0
        private static void OnValueChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            NumericUpDown control = (NumericUpDown)obj;

            decimal oldValue = (decimal)args.OldValue;
            decimal newValue = (decimal)args.NewValue;

            // Fire Automation events
            NumericUpDownAutomationPeer peer = UIElementAutomationPeer.FromElement(control) as NumericUpDownAutomationPeer;

            if (peer != null)
            {
                peer.RaiseValueChangedEvent(oldValue, newValue);
            }

            RoutedPropertyChangedEventArgs <decimal> e = new RoutedPropertyChangedEventArgs <decimal>(
                oldValue, newValue, ValueChangedEvent);

            control.OnValueChanged(e);
            control.UpdateText();
        }