Tutorial :Silverlight3: Returned localized string, when binding without converter, is always in “en-US” culture



Question:

The problem: The returned localized string for the non-string binding properties (DateTime, double...) is always set to "en-US" culture, regardless of the CurrentThread.CurrentCulture.
The solution I am looking for: I am looking for a solution other than using a converter (The localization works properly if a converter is used), since I need to implement it in an existing large Silverlight3 application where converters were not used in the first palce. The Question: How to make localization work with non-string binding properties, without converters ? thnx Krsto


Solution:1

Do the following in the constructor of your App.Xaml:
Thread.CurrentThread.CurrentCulture = new CultureInfo("sv-SE");

And then this in the constructor of every user control:
this.Language = XmlLanguage.GetLanguage(Thread.CurrentThread.CurrentCulture.Name);

That might work, give it a try. Of course you will have to adjust the culture to whatever it is you want to do.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »