首页 > 代码库 > WPF国际化(多语言)
WPF国际化(多语言)
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;namespace WpfInternationalization{ /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void Button_Click(object sender, RoutedEventArgs e) { var appResource = App.Current.Resources.MergedDictionaries; foreach (ResourceDictionary item in appResource) { if (item.Source.ToString() == "Language/en-us/Tip.xaml") { return; } if (item.Source.ToString() == "Language/zh-cn/Tip.xaml") { appResource.Remove(item); break; } } ResourceDictionary resdic=new ResourceDictionary(); resdic.Source=new Uri("Language/en-us/Tip.xaml",UriKind.Relative); appResource.Insert(0, resdic); } private void Button_Click_1(object sender, RoutedEventArgs e) { var appResource = App.Current.Resources.MergedDictionaries; foreach (ResourceDictionary item in appResource) { if (item.Source.ToString() == "Language/zh-cn/Tip.xaml") { return; } if (item.Source.ToString() == "Language/en-us/Tip.xaml") { appResource.Remove(item); break; } } ResourceDictionary resdic = new ResourceDictionary(); resdic.Source = new Uri("Language/zh-cn/Tip.xaml", UriKind.Relative); appResource.Insert(0, resdic); } }}
WPF国际化(多语言)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。