This article has move here: WPF RichTextBox Control Tutorial
The following code snippet creates RichTextBox in XAML.
- <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.
- <RichTextBox Margin="10,10,0,13" Name="RichTextBox1" HorizontalAlignment="Left"
- VerticalAlignment="Top" Width="500" Height="300" />
The following code snippet adds several items to a RichTextBox control.
- <RichTextBox Margin="10,10,0,13" Name="RichTextBox1" HorizontalAlignment="Left"
- VerticalAlignment="Top" Width="500" Height="300">
- <FlowDocument>
- <Paragraph>
- I am a flow document. Would you like to edit me?
- <Bold>Go ahead.</Bold>
- </Paragraph>
-
- <Paragraph Foreground="Blue">
- I am blue I am blue I am blue.
- </Paragraph>
- </FlowDocument>
- </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.
- SpellCheck.IsEnabled="True"
You can set this in code as follows:
- mcRTB.SpellCheck.IsEnabled = true;