This project has moved. For the latest updates, please go here.

NumericUpDown with Percent format string

May 29, 2015 at 5:59 PM
If I have the following:
<xctk:IntegerUpDown Increment="1" Minimum="1" Maximum="100" FormatString="P0" />

the value, as displayed in the control's textbox, appears multiplied by 100. If I have, says, Value=50, then "5,000 %" is displayed. And whenever I click on any of the spin buttons, the value is incremented/decremented by 100.

Perhaps I'm not using it correctly, but that's not what I expected. All I want is for the user to be able to select a value between 1 and 100, and, to make clear that it is a percentage, have a % suffix appended to the value shown.

That is applicable to version 2.4
Developer
Jun 1, 2015 at 12:09 PM
Hi,

This a a normal behavior, as you can see on this Microsoft page : https://msdn.microsoft.com/en-us/library/dwhawy9k%28v=vs.110%29.aspx

You can try with this :
<xctk:IntegerUpDown Increment="1"
                          Minimum="1"
                          Maximum="100"
                          Value="50"
                          FormatString="{}0 '%'" />
Notice the " ' " on each side of the percent symbol.
Jul 29, 2015 at 5:56 AM
Hi Team,

I am agree with "mijikin", I have a discount stored in the database, the value is "0.10", so when is displayed by the control with the property FormatString="P", the application shows "10.00 %", but what happends if the client change that value and write 15 and press enter or lost the focus, the application now show "1,500.00 %", I think that the controls should parse the text taking care of the format and not just remove the "%" character and convert tu decimal.

Please tell me if you will change this, because right now the clients have to use decimal characters like ".15" to define "15.00%"

Thanks.
Developer
Jul 30, 2015 at 4:07 PM