我是 WPF 新手.
我正在尝试更改文本框内的语言,在窗口窗体中,我正在使用此代码.
I'm trying to change the language within the text box when writing inside, In a window form i was using this code.
System.Globalization.CultureInfo TypeOfLanguage = new System.Globalization.CultureInfo("en-us");
InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(TypeOfLanguage);
我不知道如何更改语言的问题因为代码在 WPF 中不起作用.
The problem I do not know how I will be able to change the language Because the code does not work in WPF.
请帮助我如何更改输入语言?
Please help me How i can change the input language ?
为了完成你必须使用 InputLanguageManager 类
In order to acomplish that you have to use InputLanguageManager Class
this.Dispatcher.Thread.CurrentCulture.Name.ToString();
InputLanguageManager.SetInputLanguage(myTextBox, CultureInfo.CreateSpecificCulture("fr"));
tb2.Text = "Available Input Languages:";
lb1.ItemsSource = InputLanguageManager.Current.AvailableInputLanguages;
tb3.Text = "Input Language of myTextBox is " + InputLanguageManager.GetInputLanguage(myTextBox).ToString();
tb4.Text = "CurrentCulture is Set to " + this.Dispatcher.Thread.CurrentCulture.Name.ToString();
注意:链接上方的代码粘贴表单...
Note: Code pasted form above link...
这篇关于如何更改 wpf 中的语言文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!