This project has moved. For the latest updates, please go here.

All of the UpDown classes set Args.RoutedEvent to IntegerUpDown.ValueChangedEvent

Jun 14, 2012 at 2:41 PM

Hello,

When investigating the various *UpDown classes, I noticed that all of them set the args.RoutedEvent to IntegerUpDown.ValueChangedEvent. Is this by design or a bug? Should they not point to the various DecimalUpDown.ValueChangedEvent, DoubleUpDown.ValueChangedEvent, etc values?

    protected override void OnValueChanged(decimal? oldValue, decimal? newValue)
    {
        // Must call base version first.
        base.OnValueChanged(oldValue, newValue);

        // Event args must be of type object.
        RoutedPropertyChangedEventArgs<object> args = new RoutedPropertyChangedEventArgs<object>(oldValue, newValue);
        args.RoutedEvent = IntegerUpDown.ValueChangedEvent;
        RaiseEvent(args);
    }
Coordinator
Jun 15, 2012 at 9:06 PM

Hi,

 

I have not been able to find the code you are looking at.  Could you tell me which version of the toolkit you are using?  In which class or file is this method located?

 

Thank you.

Jun 18, 2012 at 3:52 PM

Hello,

We are using version 1.6 and I found the code referenced above in the following places.

// 1. DoubleUpDown.cs
    protected override void OnValueChanged(double? oldValue, double? newValue)
    {
        // Must call base version first.
        base.OnValueChanged(oldValue, newValue);

        // Event args must be of type object.
        RoutedPropertyChangedEventArgs<object> args = new RoutedPropertyChangedEventArgs<object>(oldValue, newValue);
        args.RoutedEvent = IntegerUpDown.ValueChangedEvent;
        RaiseEvent(args);
    }

// 2. DecimalUpDown.cs
    protected override void OnValueChanged(decimal? oldValue, decimal? newValue)
    {
        // Must call base version first.
        base.OnValueChanged(oldValue, newValue);

        // Event args must be of type object.
        RoutedPropertyChangedEventArgs<object> args = new RoutedPropertyChangedEventArgs<object>(oldValue, newValue);
        args.RoutedEvent = IntegerUpDown.ValueChangedEvent;
        RaiseEvent(args);
    }
Coordinator
Jun 18, 2012 at 4:47 PM
Edited Jun 18, 2012 at 4:49 PM

The DoubleUpDown and the DecimalUpDown control aren't overriding the OnValueChanged method.  The code you are refering to doesn't exists on my side.

 

Here is the code from the repository of the two classes you are mentionning for version 1.6:

 

Jun 18, 2012 at 8:18 PM

Sorry, those must have been our old mods. I apologize for sending you on a wild goose chase.