2

Closed

Numberic UpDown Data Binding not working when you press up or down key numerous times

description

I belive this si a bug in controls inheriting UpDownBase class.1. Databind value properto of any control inheriting UpDownBase , for example IntegerUpDown, DecimalUpDown, etc...2. Press Up or Down button few times.Result: Binded property does not get changed until you remove focus from the control or press the other up or down button.For example. If I press up key 5 times, the property will not change. If I remove focus from the control or press down key after the 5th time, then it will change.Resolution:I fixed this issue by replacing the line: public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(T), typeof(UpDownBase), new FrameworkPropertyMetadata(default(T), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnValueChanged, null, false, UpdateSourceTrigger.LostFocus));withpublic static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(T), typeof(UpDownBase), new FrameworkPropertyMetadata(default(T), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnValueChanged, null, false, UpdateSourceTrigger.PropertyChanged));i.e. UpdateSourceTrigger.LostFocus with UpdateSourceTrigger.PropertyChangedIf this fix makes sense, please include it in the next release.
Closed Jun 15, 2013 at 2:30 AM by emartin

comments

emartin wrote Nov 13, 2012 at 4:09 PM

This would be more simply done by setting it on your binding, like:
<xctk:IntegerUpDown Value="{Binding MyValue, UpdateSourceTrigger=PropertyChanged" />

In version 1.9, we may update the default behavior, just like you said.

emartin wrote Nov 13, 2012 at 4:12 PM

sorry, I forgot the ending "}" in the previous code snippet:
<xctk:IntegerUpDown Value="{Binding MyValue, UpdateSourceTrigger=PropertyChanged}" />

emartin wrote Nov 21, 2012 at 2:49 PM

Fixed in version 1.9