RichTextBox.TextWrapping Property
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Gets or sets how text wrapping occurs if a line of text extends beyond the available width of the RichTextBox.
Namespace: System.Windows.Controls
Assembly: System.Windows (in System.Windows.dll)
Syntax
'Declaration
Public Property TextWrapping As TextWrapping
public TextWrapping TextWrapping { get; set; }
<RichTextBox TextWrapping="Wrap"/>
-or-
<RichTextBox TextWrapping="NoWrap"/>
Property Value
Type: System.Windows.TextWrapping
One of the TextWrapping values. The default is Wrap.
Remarks
You should consider the width of the RichTextBox when you set the TextWrapping property. Any text that extends beyond the bounds of the RichTextBox will not be displayed. If the TextWrapping property is set to NoWrap, text that exceeds the horizontal bounds can be scrolled into view using the cursor. Text that exceeds vertically can be scrolled into view using the keyboard or scrollbar. If the TextWrapping property is set to Wrap, the HorizontalScrollBarVisibility property is automatically set to Disabled and any property changes to the HorizontalScrollBarVisibility are ignored.
Examples
The following XAML shows how to use the TextWrapping property.
<RichTextBox Margin="20,20,0,0" Width="300" Height="50" TextWrapping="Wrap" AcceptsReturn="True">
<Paragraph>
A RichTextBox that demonstrates TextWrapping and AcceptsReturn properties
</Paragraph>
</RichTextBox>
Version Information
Silverlight
Supported in: 5, 4
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.