RichTextBox for UWP | ComponentOne
Working with RichTextBox for UWP / Setting and Formatting Content / Text Content
In This Topic
    Text Content
    In This Topic

    The content of the C1RichTextBox can be specified in two ways, using the C1RichTextBox.Text property or the C1RichTextBox.Html property. The C1RichTextBox.Text property is used to assign and retrieve the control content as plain text. There are a few different ways to set the text content.

    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 add Text="Hello World!" to the <c1rtb:C1RichTextBox> tag so that it appears similar to the following:

    XAML Markup
    Copy Code
    <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
    Me.C1RichTextBox1.Text = "Hello World!"
    

    C#
    Copy Code
    this.c1RichTextBox1.Text = "Hello World!";
    

    The C1RichTextBox also exposes a C1RichTextBox.TextWrapping property that specifies whether the control should wrap long lines or whether it should keep the lines together and provide a horizontal scrollbar instead.

    Visual Basic
    Copy Code
    Me.C1RichTextBox1.TextWrapping = TextWrapping.NoWrap
    

    C#
    Copy Code
    this.c1RichTextBox1.TextWrapping = TextWrapping.NoWrap;
    

    The code above sets the C1RichTextBox control so that text content will not wrap in the control and will appear in a continuous line.