RichTextBox.TextWrapping Property

July 28, 2014

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)
XMLNS for XAML: Not mapped to an xmlns.

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.

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

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>


Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

Show:
© 2014 Microsoft