Using C1FlexGrid with different separators

Posted by: msloan on 26 October 2020, 9:11 pm EST

  • Posted 26 October 2020, 9:11 pm EST

    Hi,
    I have changed my decimal point from a period (.) to a comma (,) in Windows 10. Excel displays floating point numbers with the comma separator as expected. I have created a data grid control based upon C1DataGrid. I have found that floating point numbers are still displayed with a period, (example 75.00). Should I not be displaying floating point numbers with a comma (75,00). What am I doing wrong or not doing?

    Mark Sloan
  • Replied 28 October 2020, 5:20 am EST

    Hi Mark,

    WPF uses "en-us" culture by-default and Microsoft's DataGrid shows the same behavior. So, it is not specific to ComponentOne controls.
    So, to show comma as decimal separator, please try to use the following code:
    System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("pt-BR");
    System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
    Language = XmlLanguage.GetLanguage(System.Threading.Thread.CurrentThread.CurrentCulture.Name);
    Regards,
    Ruchir
  • Marked as Answer

    Replied 28 October 2020, 5:20 am EST

    Hi Mark,

    WPF uses "en-us" culture by-default and Microsoft's DataGrid shows the same behavior. So, it is not specific to ComponentOne controls.
    So, to show comma as decimal separator, please try to use the following code:
    System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("pt-BR");
    System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
    Language = XmlLanguage.GetLanguage(System.Threading.Thread.CurrentThread.CurrentCulture.Name);
    Regards,
    Ruchir
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels