views:

56

answers:

2

My RIA enabled Silverlight Application is setting the thread culture in the App constructor (this is absolutley okay since it is an intranet application and will never ever be used by someone who is not german):

public App() {
    InitializeComponent();
    Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
}

It does what it should, the DataForms are displaying datetime values in german notation. BUT: it is spontaneously changing to en-US notation when navigating between items in the data source that is bound to the DataForm. Why?

A: 

It seems that the thread culture is not inherited by every control. Just for fun I displayed the Language of the control, and it was alwas set to en-US. To solve this, I hard coded the language de-DE in the style for the DataForm.

The same problem was described by Hannes (in german). Surprisingly in this case it was exactly the other way round: the DataForm was german, but the grid was english.

Marc Wittke
A: 

As Marc Wittke said, the thread culture is not inherited by every control (why on earth???)

Any way, you do not need to hardcode the values, this put this line in your Control constructor:

Language = XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.Name);

And you control will use the CurrentCulture.

Cheers,

André

andrecarlucci