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

6 posts, 0 answers
  1. Radiation
    Radiation avatar
    13 posts
    Member since:
    Jul 2012

    Posted 19 Jul 2013 Link to this post

    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;
  2. Radiation
    Radiation avatar
    13 posts
    Member since:
    Jul 2012

    Posted 19 Jul 2013 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Daniel
    Daniel avatar
    23 posts
    Member since:
    May 2009

    Posted 22 Jul 2013 Link to this post

    no answer?

    When it will be fixed?
  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 24 Jul 2013 Link to this post

    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 >>
  6. Daniel
    Daniel avatar
    23 posts
    Member since:
    May 2009

    Posted 24 Jul 2013 Link to this post

    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.
  7. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 29 Jul 2013 Link to this post

    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 >>
Back to Top
UI for WPF is Visual Studio 2017 Ready