WPF: How to change the CurrentUICulture at runtime

23,340

What am I missing?

You changed the culture registered with the thread, and String.Format will use this now, but you need to reload all localized items in the WPF hierarchy.

WPF Localization – On-the-fly Language Selection has more information.

Share:
23,340
Bob
Author by

Bob

Updated on April 21, 2020

Comments

  • Bob
    Bob about 4 years

    I am trying to change the language my WPF app uses in a click event but it doesn't change.

    private void menuItemGerman_Click(object sender, RoutedEventArgs e)
    {
       Settings.Default.Culture = "de-DE";
    
       Thread.CurrentThread.CurrentCulture = new CultureInfo(Settings.Default.Culture);
       Thread.CurrentThread.CurrentUICulture = new CultureInfo(Settings.Default.Culture);
    }
    

    What am I missing?