WPF Spell check

故事扮演 提交于 2019-12-12 19:14:42

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/1185481/wpf-spell-check

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!