Dusan Kocurek
Dusan Kocurek

Reputation: 445

WPF Spell check

I'm playing with the integrated spell check in WPF.

I need to configure it dynamically from code behind, not just in XAML. XAML solution works perfectly (SpellCheck.IsEnabled=true + xml:lang attribute).

However if I try to enable spell check using this code snippet, it is not working:

Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); 
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
tb.SpellCheck.IsEnabled = true;

Any ideas?

Thank you very much

Upvotes: 2

Views: 1547

Answers (1)

Paul van Brenk
Paul van Brenk

Reputation: 7549

        tb.Language = System.Windows.Markup.XmlLanguage.GetLanguage("en-us");
        tb.SpellCheck.IsEnabled = true;

Upvotes: 4

Related Questions