1
我試圖在RichTextBox中添加自定義字典(* .lex格式,utf-16編碼)來製作拼寫檢查,但它不起作用。如果我使用TextBox的這種代碼,它的工作原理。如何在wpf richtextbox中製作工作自定義字典
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,但它沒有效果。 你知道如何解決這個問題嗎?