Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting spellcheck language for textbox WITHOUT changing keyboard language possible?

I am using C# & .Net 4.0 and want to set the a differnet spellcheck language for a textbox without changing the keyboard layout.

I found out by reading great postings here that it is possible to change InputLanguage.CurrentInputLanguage for changing the SpellCheck language of my textbox. But this has the sideeffect, that the keyboard layout/language was changed too. But I need always an EN SpellCheck for my textbox without crashing the users keyboard settings. Is there any way for this case?

Thanks in Advance for every hint that can help me to solve this case.

like image 239
vicklik Avatar asked Mar 19 '23 01:03

vicklik


1 Answers

I have found out, how to solve it.

You have to know, that I use the WPF TextBox in a Winforms project. Here is a sample code:

System.Windows.Forms.Integration.ElementHost elementHost1 = new System.Windows.Forms.Integration.ElementHost();
System.Windows.Controls.TextBox textBox = new System.Windows.Controls.TextBox();
textBox.Language = System.Windows.Markup.XmlLanguage.GetLanguage("en-GB");
textBox.SpellCheck.IsEnabled = true;
elementHost1.Child = textBox;
like image 70
vicklik Avatar answered Apr 26 '23 14:04

vicklik