This is a migrated thread and some comments may be shown as answers.

Value is rounded by default and updates binding source withou changing value

5 Answers 190 Views
NumericUpDown
This is a migrated thread and some comments may be shown as answers.
Radiation
Top achievements
Rank 1
Radiation asked on 19 Jul 2013, 11:25 AM
The simples example as it could be:

Althought NumberDecimalDigits is set to -1 by default, value is rouded to 2 and the property of viewmodel is updated immedialely without user interaction. This is neither expected nor acceptable behaviour. It makes unusable any changetracking viewmodels and causes many other problems.

View:
<telerik:RadNumericUpDown Value="{Binding NumberProperty, Mode=TwoWay}"   />

ViewModel:
public double NumberProperty
{
  get { return _NumberProperty; }
  set
  {
    if (_NumberProperty != value)
    {
      _NumberProperty = value;
      OnPropertyChanged();
    }
  }
}
private double _NumberProperty = 25.56365;

5 Answers, 1 is accepted

Sort by
0
Radiation
Top achievements
Rank 1
answered on 19 Jul 2013, 11:33 AM
And if you select the radnumericupdown and then it will lost its focus, the ViewModel's NumberProperty is updated to its original value, LOL :D
0
Daniel
Top achievements
Rank 1
answered on 22 Jul 2013, 02:36 PM
no answer?

When it will be fixed?
0
Konstantina
Telerik team
answered on 24 Jul 2013, 11:28 AM
Hi,

The default value of the NumberDeciamalDigits is 2. This is what says the MSDN documentation:

"Property Value

The number of decimal places to use in numeric values. The default for InvariantInfo is 2."

The value of the numeric is formatted before it is displayed, that is way the property is changed.
Also, the Value property is updated on LostFocus. You could set the UpdateValueEvent="PropertyChanged" property of the RadNumericUpDown control.
If you could give us some more details about the difficulties you experience, we will do out best to provide you with the best solution.

Regards,
Konstantina
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Daniel
Top achievements
Rank 1
answered on 24 Jul 2013, 12:12 PM
1. NumberDecimalDigits is DependencyProperty of RadNumericUpDown so it should not be related to MSDN.
2. Whatever the value of NumberDecimalDigits is, its a FORMATTING property. It is not acceptable, that the binding source is immediatelly updated with the rounded value. Formatting should be only for display reason, when displaying the value.
3. Write a Debug.WriteLine(value) into setter of the NumberProperty (see first post in this thread). Then run the sample, focus the control and press tab. You will see the nonsense.
0
Konstantina
Telerik team
answered on 29 Jul 2013, 03:18 PM
Hello,

I have logged the issue in PITS, you could track its status here: http://www.telerik.com/support/pits.aspx#/public/wpf/15460 to see when it is going to be fixed.

Regards,
Konstantina
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
NumericUpDown
Asked by
Radiation
Top achievements
Rank 1
Answers by
Radiation
Top achievements
Rank 1
Daniel
Top achievements
Rank 1
Konstantina
Telerik team
Share this question
or