Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

TextBlock.TextWrapping Property

Gets or sets how the TextBlock wraps text.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

public TextWrapping TextWrapping { get; set; }
<TextBlock TextWrapping="Wrap"/>

Property Value

Type: System.Windows.TextWrapping
A value that indicates how the TextBlock wraps text. The default is TextWrapping.NoWrap.

Dependency property identifier field: TextWrappingProperty

The TextWrapping property indicates how text wraps in a TextBlock. The TextWrapping enumeration defines two values: NoWrap and Wrap.

NoteNote:

In Silverlight, this property does not support a WrapWithOverflow value.

ActualHeight and ActualWidth are read-only properties that report the rendered height and width of the TextBlock. These properties can be different than the Height and Width properties of the TextBlock. Setting the TextWrapping property affects the ActualHeight and ActualWidth values of the TextBlock.

The following illustration shows how the TextWrapping property affects ActualHeight and ActualWidth.

How TextWrapping affects ActualWidth and ActualHeight

TextWrapping example.

The following XAML example shows how to set the TextWrapping property to NoWrap and to Wrap.

<!-- TextBlock with no text wrapping -->
<TextBlock
  Text="The quick red fox jumped over the lazy brown dog."
  Width="200"
  TextWrapping="NoWrap" />

<!-- TextBlock with text wrapping -->
<TextBlock
  Text="The quick red fox jumped over the lazy brown dog."
  Width="200"
  TextWrapping="Wrap" />

The following illustration shows the rendered text from the previous XAML example.

TextBlock rendering non-wrapped and wrapped text

Shows text getting cut off.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

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

Community Additions

Show:
© 2014 Microsoft