corelibraries-devexpress-dot-xtraspellchecker-dot-spellcheckerbase-c42fa20a.md
Occurs when a misspelled word is found and a list of suggested replacements is created and sorted.
Namespace : DevExpress.XtraSpellChecker
Assembly : DevExpress.SpellChecker.v25.2.Core.dll
NuGet Package : DevExpress.SpellChecker.Core
public event PrepareSuggestionsEventHandler PrepareSuggestions
Public Event PrepareSuggestions As PrepareSuggestionsEventHandler
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. |
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));
}
Private Sub spellChecker1_PrepareSuggestions(ByVal sender As Object, ByVal e As PrepareSuggestionsEventArgs)
Dim pattern As String = "(De|de)[a-z]+x[a-z]*s+"
Dim rgx As New System.Text.RegularExpressions.Regex(pattern)
If rgx.IsMatch(e.Word) Then
e.Suggestions.Insert(0, New SuggestionBase("DevExpress", 0))
End If
End Sub
See Also