TextBox.TextWrapping Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets how line breaking occurs if a line of text extends beyond the available width of the text box.
public:
property TextWrapping TextWrapping { TextWrapping get(); void set(TextWrapping value); };
TextWrapping TextWrapping();
void TextWrapping(TextWrapping value);
public TextWrapping TextWrapping { get; set; }
var textWrapping = textBox.textWrapping;
textBox.textWrapping = textWrapping;
Public Property TextWrapping As TextWrapping
<TextBlock TextWrapping="Wrap"/>
-or-
<TextBlock TextWrapping="NoWrap"/>
Property Value
One of the TextWrapping values. The default is NoWrap.
Examples
The following example shows how you can use the TextWrapping property in XAML.
<StackPanel>
<TextBox Text="A text box that demonstrates TextWrapping, TextAlignment, MaxLength, and AcceptsReturn"
TextWrapping="Wrap" TextAlignment="Center"
MaxLength="500" AcceptsReturn="True"
Margin="20,20,0,0" Width="300" Height="50"/>
</StackPanel>
Remarks
TextBox and RichEditBox don't support the WrapWholeWords value for their TextWrapping properties. If you try to use WrapWholeWords as a value for TextBox.TextWrapping or RichEditBox.TextWrapping, an exception is thrown.