Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么不正确地添加自定义词典?_C#_Wpf_Spell Checking - Fatal编程技术网

C# 为什么不正确地添加自定义词典?

C# 为什么不正确地添加自定义词典?,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

<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);
}