Removing entries from Custom Dictionary does not fire event

6 posts, 2 answers
  1. Bob
    Bob avatar
    63 posts
    Member since:
    Aug 2010

    Posted 29 Mar Link to this post

    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.

  2. Answer
    Peshito
    Admin
    Peshito avatar
    522 posts

    Posted 03 Apr Link to this post

    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.
  3. Bob
    Bob avatar
    63 posts
    Member since:
    Aug 2010

    Posted 03 Apr in reply to Peshito Link to this post

    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

  4. Bob
    Bob avatar
    63 posts
    Member since:
    Aug 2010

    Posted 03 Apr in reply to Peshito Link to this post

    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? 
  5. Bob
    Bob avatar
    63 posts
    Member since:
    Aug 2010

    Posted 03 Apr in reply to Bob Link to this post

    I found the answer to the refresh problem:

    radRichTextBox.InvalidateProofingErrors(false);
  6. Answer
    Peshito
    Admin
    Peshito avatar
    522 posts

    Posted 05 Apr Link to this post

    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.
Back to Top