默认的软件中的控件会自动监测本机语言系统,从而界面上的日期控件等会自动切换成对应的中/英文。为了保证系统一直处于中文状态,可在App.xaml.cs 中添加
System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("zh-CN"); System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-CN"); FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata( System.Windows.Markup.XmlLanguage.GetLanguage( System.Globalization.CultureInfo.CurrentUICulture.IetfLanguageTag)));