Change negative entry to absolute value of entry

4 posts, 0 answers
  1. John Galt
    John Galt avatar
    3 posts
    Member since:
    May 2012

    Posted 24 Jan 2013 Link to this post

    If I have the MinValue set to 0 and I enter a negative value in the control, the value is getting set back to 0. How would I change the behavior to change the value to the absolute value of the entry rather than zero? I already have a control built that extends from RadNumericUpDown, just not sure what to hook up to to update the value. Thanks!
  2. John Galt
    John Galt avatar
    3 posts
    Member since:
    May 2012

    Posted 24 Jan 2013 Link to this post

    Think I found it. I overrode OnApplyTemplate and setup an event handler for when the text changes and put my logic there.
  3. Cosmin
    Cosmin avatar
    1 posts
    Member since:
    May 2018

    Posted 09 May 2018 in reply to John Galt Link to this post

    Hello,

    I know this is an old post, but maybe you still remember how did you managed to "fix" this issue.

    Thank you,

    Cosmin

     

  4. Stefan
    Admin
    Stefan avatar
    1073 posts

    Posted 11 May 2018 Link to this post

    Hello Cosmin,

    In order to achieve this you can apply an IValueConverter to the binding of the Value property of RadNumericUpDown. If the value is negative you can return its absolute value.

    Hope this helps.

    Regards,
    Stefan
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top