C# 为什么不正确地添加自定义词典?
要输入文本,我使用RichTextBoxC# 为什么不正确地添加自定义词典?,c#,wpf,spell-checking,C#,Wpf,Spell Checking,要输入文本,我使用RichTextBox <RichTextBox x:Name="FlowDocumentViewer" Language="en"/> 但它不能正常工作 我做错了什么?正确答案:字典应该用UTF-16编码。那么到底是什么错了?字典和拼写检查器中的单词“юз”不正确。并提出替换字典中没有的单词。 try { this.FlowDocumentViewer.SpellCheck.SpellingReform = SpellingReform.PreAndP
<RichTextBox x:Name="FlowDocumentViewer" Language="en"/>
但它不能正常工作
我做错了什么?正确答案:字典应该用UTF-16编码。那么到底是什么错了?字典和拼写检查器中的单词“юз”不正确。并提出替换字典中没有的单词。
try
{
this.FlowDocumentViewer.SpellCheck.SpellingReform = SpellingReform.PreAndPostreform;
Uri uri = new Uri("Resources/Russian.lex", UriKind.Relative);
if (!this.FlowDocumentViewer.SpellCheck.CustomDictionaries.Contains(uri))
{
this.FlowDocumentViewer.SpellCheck.CustomDictionaries.Add(uri);
}
this.FlowDocumentViewer.SpellCheck.IsEnabled = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}