The below section gets you started with RichTextBox control in .NET and .NET Framework versions.
In this step, you create a new WPF application and add the RichTextBox and RichTextBoxToolbar controls in XAML. After completing this step, you have a mostly functional text-rich editor.
To add the RichTextBox control to your WPF application in Design view, perform the following steps
XAML |
Copy Code
|
---|---|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml" x:Class="RTBQuickStart.MainWindow" Title="MainWindow" Height="350" Width="525"> |
XAML |
Copy Code
|
---|---|
<StackPanel HorizontalAlignment="Left" Margin="0,10,0,0" x:Name="SP" VerticalAlignment="Top" Height="418" Width="645" Grid.ColumnSpan="2" Grid.Column="1"/> |
XAML |
Copy Code
|
---|---|
<c1:C1RichTextBox Name="c1RichTextBox1" Margin="0,127,0,10"/> <c1:C1RichTextBoxToolbar RichTextBox="{Binding ElementName= c1RichTextBox1}" Name="C1RTBTB" Margin="3,0,-3,197" /> |
On running the application, you see an almost fully functional RichTextBox application. You can enter text in the RichTextBox control and edit the text using the options in the RichTextBoxToolbar. In the next step, you set up spell-checking and customize the application further.
In this step, you create a new WPF core application and add the RichTextBox control in XAML. After completing this step, you have a mostly functional text-rich editor.
To add the RichTextBox control to your WPF core application in Design view, perform the following steps
XAML |
Copy Code
|
---|---|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml" x:Class="RTBQuickStart.MainWindow" Title="MainWindow" Height="350" Width="525"> |
XAML |
Copy Code
|
---|---|
<StackPanel HorizontalAlignment="Left" Margin="0,10,0,0" x:Name="SP" VerticalAlignment="Top" Height="418" Width="645" Grid.ColumnSpan="2" Grid.Column="1"/> |
XAML |
Copy Code
|
---|---|
<c1:C1RichTextBox Name="c1RichTextBox1" Margin="0,127,0,10"/> |
On running the application, you see an almost fully functional RichTextBox application. You can enter text in the RichTextBox control and edit the text using the options. To know more about the available editing features in .NET RichTextBox, browse through the respective feature topics.