1、编写Chinese.xml,English.xml文件
2.、在项目的App.xml文件中
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/WPFMultiLanguage;component/Resources/Language/Language1.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
3、编写事件
private void SetLanguage()
{
ResourceDictionary dict = new ResourceDictionary();
int select = this.setPage.ComBoxLanguage.SelectedIndex;
if (select == 0)//中文
{
dict.Source = new Uri(@"Resources\Language\Language1.xaml" , UriKind.Relative);
}
else
{
dict.Source = new Uri(@"Resources\Language\English.xaml" , UriKind.Relative);
}
Application.Current.Resources.MergedDictionaries[0] = dict;
}