RichTextBox.TextWrapping Property


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)

public TextWrapping TextWrapping { get; set; }
<RichTextBox TextWrapping="Wrap"/>
<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. 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.

The following XAML shows how to use the TextWrapping property.

<RichTextBox Margin="20,20,0,0" Width="300" Height="50" TextWrapping="Wrap" AcceptsReturn="True">
        A RichTextBox that demonstrates TextWrapping and AcceptsReturn properties


Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Ajouts de la communauté