locked
How to set WPF application decimal separator format that does not depend on windows regional settings? RRS feed

  • Question

  • Hi. Is there a way to set my application decimal and number format regardless of windows regional settings? What I would like is that all decimal values are formatted like this "1 000 000,00" and all integer values are formatted like this "1 000 000".

    • Moved by CoolDadTx Wednesday, May 15, 2013 2:01 PM WPF related
    Wednesday, May 15, 2013 10:08 AM

All replies

  • Hi.

    Try this.

    Dim newCulture As CultureInfo = new CultureInfo("en-US")
    CurrentThread.CurrentCulture = newCulture

    Best regards

    Karl-Henrik "KH" Nilsson

    Wednesday, May 15, 2013 10:44 AM
  • While it is possible to "fix" the regional settings (even to ones you wrote yourself) this is generally a bad idea. Go one step back and tell us what do you think this would solve?

    You might actually be after format strings:

    http://www.csharp-examples.net/string-format-double/


    Let's talk about MVVM: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b1a8bf14-4acd-4d77-9df8-bdb95b02dbe2

    Wednesday, May 15, 2013 12:06 PM