Skip to main content

SpellCheckerBase.PrepareSuggestions Event

Occurs when a misspelled word is found and a list of suggested replacements is created and sorted.

Namespace: DevExpress.XtraSpellChecker

Assembly: DevExpress.SpellChecker.v24.1.Core.dll

NuGet Package: DevExpress.SpellChecker.Core

Declaration

public event PrepareSuggestionsEventHandler PrepareSuggestions

Event Data

The PrepareSuggestions event's data class is PrepareSuggestionsEventArgs. The following properties provide information specific to this event:

Property Description
Suggestions Provides access to the collection of prepared suggestions.
Word Gets a misspelled word for which the suggestions have been prepared.

Example

The following code of the SpellCheckerBase.PrepareSuggestions event handler checks whether the misspelled word matches the specified pattern. If it does, a word to replace the misspelled word is added to the list of suggestions in the SpellChecker context menu.

void spellChecker1_PrepareSuggestions(object sender, PrepareSuggestionsEventArgs e)
{
    string pattern = "(De|de)[a-z]+x[a-z]*s+";
    System.Text.RegularExpressions.Regex rgx = new System.Text.RegularExpressions.Regex(pattern);
    if (rgx.IsMatch(e.Word)) e.Suggestions.Insert(0, new SuggestionBase("DevExpress", 0));
}
See Also