| sly 的个人资料Silverlight and Internat...照片日志列表 | 帮助 |
|
2009/7/14 Silverlight 3 Intl ImprovementsAs you aware by now Silverlight 3 is now available on http://microsoft.com/silverlight
Below is a list of international features that have seen updated in this release.
1. Comprehensive documentation on localization : http://msdn.microsoft.com/en-us/library/cc838238(VS.95).aspx 2. Local Font support including Cambria and Segoe UI http://msdn.microsoft.com/en-us/library/dd547542(VS.95).aspx 3. ClearType support (Tip: Greatly improved but use native resolution) 4. Merged Dictionary Support 5. Element to Element Binding 6. Bug fixs - Improved support for asian cultures on XP, thai input issue
Im still waiting patiently for the localized runtimes and tools but that is generally very quick after the main launch.
Anyway below is a sample enables updating UI strings in realtime without re-starting your application.
This uses a singleton class to the PublicResxFileCodeGenerator that implements iNotifyProperyChanged
public class LocStrings :INotifyPropertyChanged { // INotifyPropertyChanged plumbing public event PropertyChangedEventHandler PropertyChanged; private void NotifyChange(String name) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(name)); } //public constructor public LocStrings() { } // PublicResXFileCodeGenerator private static loc.Strings lStrings = new loc.Strings(); public loc.Strings LStrings { get { return lStrings; } set { NotifyChange("LStrings");} } }
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox langddl = sender as ComboBox; string selectedLang = (langddl.SelectedItem as ComboBoxItem).Content.ToString(); ; Thread.CurrentThread.CurrentCulture = new CultureInfo(selectedLang); Thread.CurrentThread.CurrentUICulture = new CultureInfo(selectedLang); ((LocStrings)this.Resources["LStrings"]).LStrings = new SL3Loc.loc.Strings(); }
Demo: http://silverlight.services.live.com/invoke/6655/SL3loc/iframe.html Code: http://cid-2b248d261d0e0035.skydrive.live.com/self.aspx/Public/SL3Loc.zip
BTW: SilverlightRTL updated their excellent code to work on SL3 http://blogs.microsoft.co.il/blogs/alex_golesh/archive/2009/07/10/silverlight-3-hebrew-and-arabic-support.aspx
|
|
|