Modal Spell-Checking
The CheckControlAsync method will spell check controls that implement the ISpellCheckableEditor interface. The Microsoft TextBox control and the C1RichTextBox controls implement this interface out of the box. You can create your own classes to provide spell-checkable wrappers for other controls.
The code below illustrates this mode:
// Show modal spell-checking
private void Button2_Click(object sender, RoutedEventArgs e)
{
// Hook up event hander
c1SpellChecker1.CheckControlCompleted +=
c1SpellChecker1_CheckControlCompleted;
// Spell-check a textbox
c1SpellChecker1.CheckControlAsync(textBox1);
// Unhook the event hander
c1SpellChecker1.CheckControlCompleted +=
c1SpellChecker1_CheckControlCompleted;
}
void c1SpellChecker1_CheckControlCompleted(object sender,
CheckControlCompletedEventArgs e)
{
Debug.WriteLine("CheckControlCompleted: {0} errors found",
e.ErrorCount);
if (e.Cancelled)
WriteLine("\t(cancelled...)");
}
This code shows a spell checking dialog box and highlights each spelling error, providing suggestions and allowing the user to fix or ignore each error. When the process is completed, the CheckControlCompleted event fires and provides feedback to the user.