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

NumericUpDown - ValueChanged event not working?

Dec 23, 2010 at 9:37 PM
Edited Dec 23, 2010 at 9:42 PM

The NumericUpDown control is a godsend but I'm not sure if I'm using it incorrectly.

Specifically, the ValueChanged event doesn't seem to be working for me.  The ValueChanged event never reaches my hosting code.  I can trace into the NumericUpDown internals and see that it's own version  of "OnValueChanged()" is called but I don't understand WPF enough to figure out if something is missing. Could anyone share any insight on what I am doing wrong? TIA, Chris

// Window1.xaml

<Window x:Class="TryControls.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:extToolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit.Extended"
    Title="Window1" Height="300" Width="300">
    
    <!--<Window.Resources>
        
    </Window.Resources>-->
    
    <Grid>
        <Canvas>
            <extToolkit:NumericUpDown Name="numericUpDown" Minimum="0" Maximum="100" Width="70" 
                Height="19" Canvas.Left="175" Canvas.Top="191"
                ValueChanged="NumericUpDown_ValueChanged" />
        </Canvas>
    </Grid>
</Window>

 

 

// Windown1.xaml.cs

 

private void NumericUpDown_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) { return; // never reaches here }

// Inside NumericUpDown.cs

protected override void OnValueChanged(RoutedPropertyChangedEventArgs<double> e)
{
    SetValidSpinDirection(); // reaches here when I press the increment or decrement button
}

 

Dec 23, 2010 at 11:10 PM

Yes, this was a known issue in v1.2.  please download the latest souce and this problwm will not occur.  Or you can wait until the release of v1.3 in Jan.  You could also add: base.OnValueChanged(e); to the OnValueChanged method.

Dec 24, 2010 at 12:08 AM

THANK YOU! You rock!

Happy holidays,

-Chris

From: brianlagunas [email removed]
Sent: Thursday, December 23, 2010 6:11 PM
To: 911tech@comcast.net
Subject: Re: NumericUpDown - ValueChanged event not working? [wpftoolkit:239450]

From: brianlagunas

Yes, this was a known issue in v1.2. please download the latest souce and this problwm will not occur. Or you can wait until the release of v1.3 in Jan. You could also add: base.OnValueChanged(e); to the OnValueChanged method.