C1 Language

Posted by: patrick.muellner on 3 September 2024, 5:23 am EST

  • Posted 3 September 2024, 5:23 am EST

    Hi,

    we’re looking for the best approach to ensure that all C1 controls in our solution consistently use the “de-DE” culture setting. Currently, at the Application StartUp event, we’re setting the culture with the following code:

           Dim objCulture As New System.Globalization.CultureInfo("de-DE")
          System.Threading.Thread.CurrentThread.CurrentCulture = objCulture
          System.Threading.Thread.CurrentThread.CurrentUICulture = objCulture

    However, we would prefer not to have to set this in each XAML file, code-behind, or on every individual control. In the past, we’ve needed to manually set the culture on specific controls, like the C1NumericTextBox, but this doesn’t seem like an optimal solution.

    Could you advise on the best way to globally enforce this culture setting across all controls in the application?

    Thank you in advance for your help.

    Regards

  • Posted 4 September 2024, 5:08 am EST

    Hi Patrick,

    To apply the culture of the overall application at once, you can set it by overriding Application’s OnStartup event handler. This does not require you to set the culture in all XAML and code-behind files separately. We achieved the desired behavior by updating ‘App.xaml.cs’ file code as follows:

    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            var vCulture = new CultureInfo("de-DE");
            Thread.CurrentThread.CurrentCulture = vCulture;
            Thread.CurrentThread.CurrentUICulture = vCulture;
            CultureInfo.DefaultThreadCurrentCulture = vCulture;
            CultureInfo.DefaultThreadCurrentUICulture = vCulture;
            base.OnStartup(e);
        }
    }

    We have also attached the sample application for reference. See SetCultureC1.zip

    Kindly let us know if your requirement differs from our understanding.

    Thanks & Regards,

    Aastha

Need extra support?

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

Learn More

Forum Channels