RichTextBox for WPF | ComponentOne
C1RichTextBox Task-Based Help / Setting the Text Content
In This Topic
    Setting the Text Content
    In This Topic

    The C1RichTextBox.Text property determines the text content of the C1RichTextBox control. By default the C1RichTextBox control starts blank and without content but you can customize this at design time, in XAML, and in code. Note that you can also set HTML markup as the control's content. See Setting the HTML Content for details.

    At Design Time

    To set the C1RichTextBox.Text property, complete the following steps:

    1. Click the C1RichTextBox control once to select it.
    2. Navigate to the Properties window, and enter text, for example "Hello World!", in the text box next to the C1RichTextBox.Text property.

    This will set the C1RichTextBox.Text property to the value you chose.

    In XAML

    For example, to set the C1RichTextBox.Text property addText="Hello World!" to the <c1rtb:C1RichTextBox> tag so that it appears similar to the following:

    <c1rtb:C1RichTextBox HorizontalAlignment="Left" Margin="10,10,0,0" Name="C1RichTextBox1" VerticalAlignment="Top" Height="83" Width="208" Text="Hello World!" />

    In Code

    For example, to set the C1RichTextBox.Text property add the following code to your project:

    Visual Basic
    Copy Code
    C1RichTextBox1.Text = "Hello World!"
    
    C#
    Copy Code
    c1RichTextBox1.Text = "Hello World!";
    

    What You've Accomplished

    You've set the text content of the C1RichTextBox control. Run your application and observe that initially "Hello World!" (or the text you chose) will appear in the control:

    Note that you can also set HTML markup as the control's content. See Setting the HTML Content for details.