HowTo: Set UI language (CurrentUICulture) in Silverlight
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("el")
Others seem to have been using (C# – that’s why there is a trailing semicolon):
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("el");
assuming System.Globalization and System.Threading namespaces have been imported.
However, now that I’m building ClipFlair in Silverlight (http://clipflair.codeplex.com), I noticed both GetCultureInfo and CreateSpecificCulture aren’t exposed to Silverlight. Seems one needs for example to modify their App.xaml to use new CultureInfo("el") to do something like below (see parts in bold):
… using System.Globalization; using System.Threading; …
private void Application_Startup(object sender, StartupEventArgs e)
CultureInfo c = new CultureInfo("el");
Thread.CurrentThread.CurrentCulture = c;
Thread.CurrentThread.CurrentUICulture = c;
this.RootVisual = new MainPage();
Alternatively you can set at each XAML page/control the “language” attribute of the “UserControl” element.
If you want to enable dynamic on-the-fly localization based on end-user selection of UI language at runtime (say via a drop-down box), checkout a nice solution (the “Localizer” one) at: