This article has move here: WPF RichTextBox Control Tutorial

The following code snippet creates RichTextBox in XAML.

  1. <RichTextBox></RichTextBox>
The following code snippet sets the name, height and width of a RichTextBox control. The code also sets the horizontal alignment to left and the vertical alignment to top.
  1. <RichTextBox Margin="10,10,0,13" Name="RichTextBox1" HorizontalAlignment="Left"
  2. VerticalAlignment="Top" Width="500" Height="300" />
The following code snippet adds several items to a RichTextBox control.
  1. <RichTextBox Margin="10,10,0,13" Name="RichTextBox1" HorizontalAlignment="Left"
  2. VerticalAlignment="Top" Width="500" Height="300">
  3. <FlowDocument>
  4. <Paragraph>
  5. I am a flow document. Would you like to edit me?
  6. <Bold>Go ahead.</Bold>
  7. </Paragraph>
  8. <Paragraph Foreground="Blue">
  9. I am blue I am blue I am blue.
  10. </Paragraph>
  11. </FlowDocument>
  12. </RichTextBox>
A RichTextBox control comes with spell check functionality out-of-the-box. By setting the SpellCheck.IsEnabled property to true enables spell checking in a RichTextBox.
  1. SpellCheck.IsEnabled="True"
You can set this in code as follows:
  1. mcRTB.SpellCheck.IsEnabled = true;