The spell checker language is what keyboard layout language was when the program was started.

So trying to switch. Switching does not occur:

textEditor.ContextMenu.Language = System.Windows.Markup.XmlLanguage.GetLanguage("ru-RU"); textEditor.ContextMenu.SetResourceReference(Control.LanguageProperty, "ru-RU"); 
 public class TextEditor : RichTextBox, ITextEditorComponent, IServiceProvider, IWeakEventListener { 

XAML

 <i:Interaction.Behaviors> <SpellCheckFor:SpellCheckBehavior /> </i:Interaction.Behaviors> 

SpellCheckBehavior

 SpellCheckBehavior : Behavior<TextEditor> ... private TextEditor textEditor; textBox.SpellCheck.IsEnabled = true; textBox.SetResourceReference(Control.LanguageProperty, "ru-RU"); textEditor.ContextMenu.SetResourceReference(Control.LanguageProperty, "ru-RU"); textEditor.ContextMenu.Language = System.Windows.Markup.XmlLanguage.GetLanguage("ru-RU"); 

    1 answer 1

    Such simple code works for me here:

     <Grid> <TextBox Name="TB" SpellCheck.IsEnabled="True" Language="ru-RU" TextWrapping="Wrap"/> <Button Click="OnLanguageChange" VerticalAlignment="Bottom">Switch to English</Button> </Grid> 

    Code-behind:

     public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } void OnLanguageChange(object sender, RoutedEventArgs e) => TB.Language = XmlLanguage.GetLanguage("en-US"); } 

    changed language

    Based on this discussion , the necessary language packs may not be installed on your system. If so, they can either be installed on the user's machine, or they can drag files with dictionaries and load them as CustomDictionary .

    • How do you make gifs so beautiful? - αλεχολυτ
    • 3
      @alexolut: cockos.com/licecap . It seems to work :) - VladD
    • textBox.Language = XmlLanguage.GetLanguage("ru-RU"); Can I use two languages ​​at the same time? - codename0082016
    • @ codename0082016: I haven’t tried it, but maybe I’ll learn from some dictionaries to call and connect, for example, English? The Internet is stubbornly silent. - VladD