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

Setter not firing when using databound DoubleUpDown control

May 6, 2011 at 1:50 PM

Hi there,

Is there something I am missing? I created a WPF interface to tune a PID controller (just a line follower built from NXT) and I am trying to adjust my constants using the DoubleUpDown control, I can bind to the properties in my service no problem and see them so the getter is getting called but when I change values I never see the setter fire off (i.e. breakpoint never gets hit).

Here is some code to go with this. this is just a normal dependency property - in this case value is getting assigned to a double that is part of the service (my datacontext) but that isn't any different from when I use an adapter at work on some boring business form - Lego's are way cooler...

    public double Kp
        {
            get { return service.kp; }
            set
            {
                service.kp = value;
                OnPropertyChanged("Kp");
            }
        }

Here is the XAML

<extToolkit:DoubleUpDown Text="{Binding Path=Kp, UpdateSourceTrigger=PropertyChanged}" Width="160" Height="24" VerticalAlignment="Top" Increment=".00001"/>
Even if there was a problem there (setting the field in the service) I should at least be able to put a break point at `service.kp = value` and see it trying to set it? It's probably worth pointing out that I am using visual studio 2008 with (of course) .net 3.5 - this is because I am using Microsoft Robotics Development Studio and it doesn't support visual studio 4.0

May 6, 2011 at 1:52 PM

The problem is you need to bind to the Value property not the Text property.

May 12, 2011 at 12:43 AM

Thanks!