Visual Studio Development Bookmark and Share   
 index > Visual Studio WPF Designer > Language Settings
 

Language Settings

I have a desktop application programmed using visual basic. It works fine on the US English settings
As soon as the settings are changed to different language settings, the labels and controls in the form get messed up and move positions.
Anyways to fix this issue?
Can i force the settings to be US English all the time?
PitchforkIT  Tuesday, August 25, 2009 9:44 PM
Put this code in your application startup.

Private Sub Application_Startup(ByVal sender As Object, ByVal e As System.Windows.StartupEventArgs) Handles Me.Startup

Dim objCulture As CultureInfo = New CultureInfo("en-US")

Thread.CurrentThread.CurrentCulture = objCulture

Thread.CurrentThread.CurrentUICulture = objCulture

'HACK - Ensure the current culture passed into bindings is the OS culture.

' By default, WPF uses en-US as the culture, regardless of the system settings.

FrameworkElement.LanguageProperty.OverrideMetadata(

GetType(FrameworkElement), New FrameworkPropertyMetadata(System.Windows.Markup.XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)))

End Sub


Cheers, Karl - Microsoft Product Team, Code Project MVP - http://karlshifflett.wordpress.com/
karl140.6  Wednesday, August 26, 2009 4:10 PM
Thank you for the code, and i know this sounds naive but when i copy the above code it says " Name FrameworkElement is not declared". I dont know anything about how to initalize or use frameworkelement. Can you help me out with this?
PitchforkIT  Monday, August 31, 2009 9:51 PM
Are you writing a WPF application?
Cheers, Karl - Microsoft Product Team, Code Project MVP - http://karlshifflett.wordpress.com/
karl140.6  Wednesday, September 02, 2009 5:27 PM

You can use google to search for other answers

Custom Search

More Threads

• SDK Sample Halos 3D ListView Questions
• How to show element sizes in WPF Designer?
• Student Attendance Details
• possible bug
• Local UserControls return Type reference cannot find public type
• Getting notified when a controls is added to a WPF control
• When Cider update beyond June CTP
• Property Windows and XAML editor do not cooperate correctly
• WPF Custom Control does not show up when used more than once in the same xaml file
• WPF Design Time Toolbar items