RichTextBox for WPF | ComponentOne
Working with WPF RichTextBox / C1RichTextBox Content
In This Topic
    C1RichTextBox 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 Text property is used to assign and retrieve the control content as plain text.

    Visual Basic
    Copy Code
    Me.C1RichTextBox1.Text = "Hello World!"
    

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

    The Html property is used to assign and retrieve formatted text as HTML. The HTML text needs to be encoded in the XAML file, so, for example,  instead of <b> for bold, tags are encoded as &lt;b&gt;.

    Visual Basic
    Copy Code
    Me.C1RichTextBox1.Html = "&lt;b&gt;Hello World!&lt;/b&gt;"
    

    C#
    Copy Code
    this.c1RichTextBox1.Html = "&lt;b&gt;Hello World!&lt;/b&gt;"
    

    The C1RichTextBox 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.