TX Spell .NET for WPF

RichTextBox

Topic

The RichTextBox of WPF doesn't know TX Spell .NET, but TX Spell .NET can check its text. Two short tutorials add it: one marks misspelled words while the user types, the other opens the spell check dialog. Both need only the TX Spell .NET package, not TX Text Control.

The Spelling dialog of TX Spell .NET over a RichTextBox, showing the misspelled word "sampke" with its suggestions.

How It Works

With TX Text Control, the editor does most of the work. With a RichTextBox, your code does it:

  • You pass the text. The Check method of the TXSpellChecker checks the text of the document and lists the incorrect words with their positions in IncorrectWords.
  • You find the words in the document. A position in the text is not a position in a FlowDocument, so a small helper method walks through the document to find each word.
  • You mark and correct them. The tutorial colors misspelled words red, and the spell check dialog tells your code which word the user changed, through the IncorrectWordChanging event.

Pages in This Section