This is a migrated thread and some comments may be shown as answers.

Removing entries from Custom Dictionary does not fire event

5 Answers 84 Views
SpellChecker
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Bob asked on 29 Mar 2017, 02:41 PM

Hello, we are using a RadRichTextBox with SpellChecker dialog.  When a word is added to the custom dictionary, either through the context menu or the SpellChecker dialog, the AddWord event is fired correctly.  However, when a word is deleted from the dialog, or the Delete All is selected, no event is fired.  We are capturing both RemoveWord and DataChanged events, but they are not called.  Our current version of controls may be older, so if this was fixed in a later version, please indicate that so we can proceed accordingly.

Thanks for your help.

5 Answers, 1 is accepted

Sort by
0
Accepted
Peshito
Telerik team
answered on 03 Apr 2017, 12:33 PM
Hi Bob,

I tried the mentioned scenario with the latest version of our controls and DataChanged was successfully fired. I am attaching to the event as followed:
radRichTextBox.SpellChecker.GetCustomDictionary().DataChanged += RtbComments_DataChanged;
Could you try out with the latest version of Telerik UI for WPF?

Regards,
Peshito
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
answered on 03 Apr 2017, 03:34 PM

Thank you, that was helpful.  We were capturing the DataChanged event from the spell checker, not the dictionary.  We changed:

radRichTextBox.SpellChecker.DataChanged += RtbComments_DataChanged;

to

radRichTextBox.SpellChecker.GetCustomDictionary().DataChanged += RtbComments_DataChanged;

Now, the DataChanged event is firing when removing a word, or deleting all entries from the custom dictionary.

I have a follow-on question:  Is there an easy way to tell what happened in the DataChanged event?  It seems the EventArgs are always empty, and the only way I can tell to see what changed is to somehow inspect the Words collection in the sender object.  It would be helpful to know if one word was changed, or the collection was emptied.

Thanks again for your help,

Bob

0
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
answered on 03 Apr 2017, 04:03 PM
Peshito, one additional question:  Is there a way to force the RadRichTextBox to update the spell checking after the custom dictionary data was changed?  We would like to refresh the misspelled words after the dictionary was cleared, but this does not seem to be automatic.  How would we accomplish this in code? 
0
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
answered on 03 Apr 2017, 05:00 PM

I found the answer to the refresh problem:

radRichTextBox.InvalidateProofingErrors(false);
0
Accepted
Peshito
Telerik team
answered on 05 Apr 2017, 07:00 AM
Hi Bob,

I am glad you managed to find the answer to the refresh issue.

As for the question about the DataChanged event, this is the default behavior. You could either use the approach you have suggested by inspecting the Words collection or another approach would be to use a CustomDictionary. This CustomDictionary should implement ICustomWordDictionary and you could add the functionality you need there.

Hope this helps.

Regards,
Peshito
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
SpellChecker
Asked by
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Answers by
Peshito
Telerik team
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Share this question
or