Reputation: 1
I have RichTextBox in my WPF application. It displays one document, which can be selected in ListBox. After selecting RichTextBox.Document changes just like that:
rtb.Document = SelectedDocument;
Now I need to enable SpellCheck. I need to add CustomDictionary, because standart spellcheck doesn't support russian language. I found real big russian dictionary in .lex format (~60 Mb) and tried to adding it to SpellCheck when aplication starts:
rtb.SpellCheck.CustomDictionaries.Add(new Uri(@"pack://application:,,,/Dictionaries/Russian.lex"));
Launching time increased by 5-7 seconds, but it's ok. Main problem that SpellCheck loading that dictionary every time document changing. Each switching of document now taking this 5-7 seconds. It doesn't depends on document, I tried documents with just one symbol.
If I'm trying to change just content of document (clear Document.Blocks and fill with new content), everything working without long loadings. But in that case I'm losing images in text and connection between xaml with textbox and viewmodel.
Is there any way to forbid loading dictionary every time document changing or it would be easier to forget about standart spellchecker and find/code another one?
Upvotes: 0
Views: 814
Reputation: 61
It looks like you have too many of temp dictionaries.
If you change your dictionary and trying to add it to SpellChecker you may expect two versions of your dictionary in temp folder and in registry.
More information here
Upvotes: 1
Reputation: 1109
Did you try to disable the spell checker before switching the document content?
rtb.SpellCheck.IsEnabled = false;
Once you are done with loading the document try to reenable it.
Hope this helps.
Upvotes: 0