Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i globally set the Culture in a WPF Application?

I would like to set the Culture of a WPF application to a specific one based on user preferences.

I can do this for the current thread via Thread.CurrentThread.Current(UI)Culture, but is there any way to do this globally for the application (so it affects all threads by default)?

like image 246
Botz3000 Avatar asked Aug 12 '09 12:08

Botz3000


People also ask

What is application culture?

App Culture is the mobile application designed to respond to the need for safety during visits to museums and archaeological areas through the dissemination of correct behavior and the guarantee of social distancing along the way.

What is CultureInfo InvariantCulture in c#?

The CultureInfo. InvariantCulture property is used if you are formatting or parsing a string that should be parseable by a piece of software independent of the user's local settings. The default value is CultureInfo. InstalledUICulture so the default CultureInfo is depending on the executing OS's settings.

Which language is primarily used to develop UI in WPF?

XAML is used extensively in Windows Presentation Foundation (WPF), Silverlight, Workflow Foundation (WF), Windows UI Library (WinUI) and Universal Windows Platform (UWP). In WPF and UWP, XAML is a user interface markup language to define UI elements, data binding, and events.

What do you mean by WPF explain it in details with all its features?

Windows Presentation Foundation is a UI framework that creates desktop client applications. The WPF development platform supports a broad set of application development features, including an application model, resources, controls, graphics, layout, data binding, documents, and security. WPF is part of .


1 Answers

there is no way to set it for all threads in the application, however if you are creating the threads in your application you can set the culture for everyone by yourself as you mentioned above

To set the Culture to the Main Application use the following snippet code:

Dim newCulture As CultureInfo = new CultureInfo("fr-FR")
CurrentThread.CurrentCulture = newCulture
like image 187
Wael Dalloul Avatar answered Oct 04 '22 21:10

Wael Dalloul