# RichTextBox

> Spell check the WPF RichTextBox with a TXSpellChecker resource: map text positions to the FlowDocument, color misspelled words and correct them in a dialog.

- **Product:** TX Spell .NET for WPF
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Spell .NET for WPF > Getting Started > RichTextBox
- **464 words**
- **Web URL:** https://docs.textcontrol.com/tx-spell-dotnet-wpf/getting-started/richtextbox/
- **LLMs URL:** https://docs.textcontrol.com/tx-spell-dotnet-wpf/getting-started/richtextbox/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-spell-dotnet-wpf/getting-started/richtextbox/llms-full.txt

---

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.](https://docs.textcontrol.com/assets/img/tx-spell-dotnet-wpf/richtextbox-spelling-dialog.aaaa3b4d.webp)

### 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](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-wpf-proofing/txspellchecker/check-method/llms-full.txt) method of the [TXSpellChecker](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-wpf-proofing/txspellchecker/llms-full.txt) checks the text of the document and lists the incorrect words with their positions in [IncorrectWords](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-wpf-proofing/txspellchecker/incorrectwords-property/llms-full.txt).
- **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.

### Recommended Order

1. [Check Spelling as You Type](https://docs.textcontrol.com/tx-spell-dotnet-wpf/getting-started/richtextbox/as-you-type/llms-full.txt): create the project, declare the spell checker in XAML, and color misspelled words red while the user types.
2. [Open the Spell Check Dialog](https://docs.textcontrol.com/tx-spell-dotnet-wpf/getting-started/richtextbox/dialog/llms-full.txt): add a button that opens the dialog, and write each correction back into the document.

For a WPF `TextBox`, a validation rule checks the text on every change; [As-You-Type Checking](https://docs.textcontrol.com/tx-spell-dotnet-wpf/spell-checking/as-you-type/#validate-a-textbox-as-the-user-types) shows it.

### Pages in This Section

- [Check Spelling as You Type](https://docs.textcontrol.com/tx-spell-dotnet-wpf/getting-started/richtextbox/as-you-type/llms-full.txt): a `RichTextBox` that colors misspelled words.
- [Open the Spell Check Dialog](https://docs.textcontrol.com/tx-spell-dotnet-wpf/getting-started/richtextbox/dialog/llms-full.txt): the spell check dialog of TX Spell .NET for a `RichTextBox`.

---

## In This Section

- [Check Spelling as You Type](https://docs.textcontrol.com/tx-spell-dotnet-wpf/getting-started/richtextbox/as-you-type/llms-full.txt): Color misspelled words red in a WPF RichTextBox as users type: Check the FlowDocument text, find each IncorrectWord with TextPointer and apply the color.
- [Open the Spell Check Dialog](https://docs.textcontrol.com/tx-spell-dotnet-wpf/getting-started/richtextbox/dialog/llms-full.txt): Open the spell check dialog for a WPF RichTextBox with Check and Show(Window), and write corrections back into the FlowDocument in IncorrectWordChanging.

---

## Nearby

- **Previous:** [Open the Spell Check Dialog](https://docs.textcontrol.com/tx-spell-dotnet-wpf/getting-started/tx-text-control/dialog/llms-full.txt)
- **Next:** [Check Spelling as You Type](https://docs.textcontrol.com/tx-spell-dotnet-wpf/getting-started/richtextbox/as-you-type/llms-full.txt)
