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

Change negative entry to absolute value of entry

3 Answers 113 Views
NumericUpDown
This is a migrated thread and some comments may be shown as answers.
John Galt
Top achievements
Rank 1
John Galt asked on 24 Jan 2013, 09:51 PM
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!

3 Answers, 1 is accepted

Sort by
0
John Galt
Top achievements
Rank 1
answered on 24 Jan 2013, 10:00 PM
Think I found it. I overrode OnApplyTemplate and setup an event handler for when the text changes and put my logic there.
0
Cosmin
Top achievements
Rank 1
answered on 09 May 2018, 06:00 AM

Hello,

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

Thank you,

Cosmin

 

0
Stefan
Telerik team
answered on 11 May 2018, 08:38 AM
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.
Tags
NumericUpDown
Asked by
John Galt
Top achievements
Rank 1
Answers by
John Galt
Top achievements
Rank 1
Cosmin
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or