Hello everybody,
in my MVVM application I am using XamNumericEditor to get/set user's input about numeric properties.
My application is fully localized: when the user select from a XamMenu a different language, all texts are localized to selected locale/culture.
i would like to achieve same goal with XamNumericEditor.
I have a field properties that with en-US is 1,500.35 and would like it to be 1.500,35 if I switch to it-IT.
Moreover: it is not enough for it to be displayed according to current culture, but I'd like the runtime editing to be culture-specific: if I input "3500", when I input the second "0" the comma (NumberGroupSeparator) automatically appears.
Is there a way to do this?
Alternatively, would you help me suggesting a way to do this with XamTexEditor (I would need an additional numbering validation) if with XamNumericEditor it is too complex/unfeasible?
Thanks in advance
Valentina
Hi Valentina,
You can try setting the xamNumericeditor's FormatProvider to the new culture and change the NumberDecimalSeparator and NumberGroupSeparator according to your needs like this:
CultureInfo culture = new CultureInfo("it-IT"); culture.NumberFormat.NumberDecimalSeparator = ","; culture.NumberFormat.NumberGroupSeparator = "."; editor.FormatProvider = culture;
I've created a sample which demonstrates how to achieve this and which you can use as a starting point.
If you require any further assistance on the matter, please let me know.
Sincerely,Teodor TenevSoftware Developer
Perfect! exactly what I needed!
THANKS
Hello Valentina,
Thank you for the feedback.
We are glad to know that you were able to achieve the desired functionality.
If you have any questions, please let us know.