Working with RichTextBox for WPF and Silverlight > C1RichTextBox Content |
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 <b>.
Visual Basic |
Copy Code
|
---|---|
Me.C1RichTextBox1.Html = "<b>Hello World!</b>" |
C# |
Copy Code
|
---|---|
this.c1RichTextBox1.Html = "<b>Hello World!</b>" |
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.