【发布时间】:2015-05-29 18:56:40
【问题描述】:
我尝试在 RichTextBox 中添加自定义字典(*.lex 格式,utf-16 编码)来进行拼写检查,但它不起作用。如果我对 TextBox 使用这样的代码,它可以工作。
private void SpellCheckInit()
{
// this works
txt_Box.SpellCheck.CustomDictionaries.Add(new Uri(@"C:\dictionary.lex"));
// dictionary language is russian, but this setting makes spellcheck works
txt_Box.Language = System.Windows.Markup.XmlLanguage.GetLanguage("en-GB");
txt_Box.SpellCheck.IsEnabled = true;
// this doesn't works
richtxt.SpellCheck.CustomDictionaries.Add(new Uri(@"C:\dictionary.lex"));
var ruLang = System.Windows.Markup.XmlLanguage.GetLanguage("ru");
var enLang = System.Windows.Markup.XmlLanguage.GetLanguage("en-GB");
richtxt.Language = ruLang;
// or richtxt.Language = enLang; there are no difference for working
richtxt.SpellCheck.IsEnabled = true;
}
我已经在字典中添加了#LID1049,但它没有任何效果。 你知道如何解决这个问题吗?
【问题讨论】:
标签: c# wpf richtextbox spell-checking