15 Answers, 1 is accepted
This is expected behavior since NumericUpDown internally uses formatting with the IFormatProvider provided by the NumberFormatInfo in which formatting value of 1 is formatted as 100%. You can easily just set the ValueFormat to Numeric and set the CustomUnit to % symbol.
Thank you for contacting us, and we look forward to answering your questions again.
Sincerely yours,
Hristo Borisov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
This can't be expected behavior - definately not expected by an enduser. I can't find the
RadNumericUpDown control useful at all as a percentage entry utiltiy. In order for percentage entry to work I would expect that I can 1) limit validation from 0 to 100 can be enforced - which I can't get to work and 2) if I use the numeric scroller and change my percentage from 51% to 52% and then I click on the input area to type in a percentage amount the amount will change to 0.52
if you look at the telerik sample code the percentage input doesn't work there either - well it works but not in a useful fashion.
I used the following to get my percentage input to work:
<telerikInput:RadNumericUpDown x:Name="numPercent" |
SmallChange="1" LargeChange="1" |
Maximum="100" Minimum="0" |
Width="100" Height="25" IsEditable="True" |
ValueFormat="Numeric" CustomUnit="%" /> |
and then i use a value converter on the binding to convert the 40% into 0.40:
numPercent.SetBinding(RadNumericUpDown.ValueProperty, new Binding() |
{ |
Converter = new PercentageConverter(), |
Source = txtpercentSet, |
Mode = BindingMode.TwoWay, |
Path = new PropertyPath("Text") |
}); |
// and here is the value converter (test only) |
private class PercentageConverter : IValueConverter |
{ |
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
{ |
if (value.ToString() == string.Empty) return 0; |
double v = System.Convert.ToDouble(value) * 100; |
return v; |
} |
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
{ |
double v = (double)value / 100; |
return v; |
} |
} |
Needless to say it would be nicer to have a COTS RadNumeric control that would work with percentages.
I think you can achieve the desired behavior with the RadNumericUpDown ValueFormat=Percentage. In order to limit the percentages from 0 to 100 you must set Minimum =0 and Maximum=1. And you need to set the SmallChange to 0.01 in order for the arrows to change 1 percent down/up. I think this tweak should work fine for you.
All the best,
Boyan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
The behavior comes from the fact that the Value of the control is displayed without formatting when the control has the focus, but when it loses the focus, the Value is formatted as percentage. String.Format("{0:P}", 1.5) will return "150%", hence the behavior of RadNumericUpDown. I admit that this is strange and we should think of a way to change it in the future, however there is another problem - if someone is used to the current behavior and all of his data is stored as the current control expects, his application will be broken.
Regards,
Valeri Hristov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
For now, we don't have any plans for changing the behaviour of the NumericUpDown control. However, if we receive some more clients' requests we will consider implementing it in one of our future releases.
Please let us know if you have any other concerns about our controls.
Kind regards,
Konstantina
the Telerik team
Our application facing same complains from end user experiences.
From end user perspective , for 10 % they want to key in as 10 not 0.1.
Up and Down strollers are fine and they pretty happy but when click into control, awful complains start.
So, I strongly request Telerik team to consider/support about that feature in future release and that will be great.
Thank you for sending your feedback, it will be considered.
Regards,
Yana
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
Thank you for writing to us.
All the best,
Yana
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
This is totally farcical!
It is currently impossible to have a numeric up down control that shows 0 - 100 range that users understand but internally translates that to a double value between 0-1?
Have I got this right, because I have now spent 2 hours smashing my head against the keyboard trying to achieve this most basic UI functionality, enter a Percentage!
Anybody figured this out?
Indeed, when RadNumericUpDown has its format set to Percentage, it translates the value to double, however, when editing the value it is shown as a double as well. We understand this is confusing and we have researched various approaches for changing the current behavior, however it is not possible without introducing a breaking change in the control.
As a work-around you could use CustomUnit property set to "%" instead of Percentage format and add a converter to convert the value to double. I have attached a simple project to demonstrate the approach, please download it and give it a try.
I hope this is an acceptable solution for you.
Regards,
Yana
Telerik by Progress
As I posted to you in the trouble ticket you do not need to introduce a breaking change you could easily add another CustomUnit to support this (the most standard use-case). At the very least document this bug you won't fix.
Further more RadMaskedNumericInput works perfectly, so we have 2 different controls with 2 different patterns, one broken and confusing, one working as expected.
Use this instead
<
telerik:RadMaskedNumericInput
FormatString
=
"P"
Mask
=
P
Value
=
"{Binding PercentageValue, Mode=TwoWay}"
/>
Sorry error in the above snippet it should be
<
telerik:RadMaskedNumericInput
FormatString
=
"P"
Mask
=
""
Value
=
"{Binding PercentageValue, Mode=TwoWay}"
/>