Freigeben über


TextWrapping

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets a value that indicates how a text container should wrap text.

<object TextWrapping="TextWrapping"  .../>
value = object.TextWrapping
object.TextWrapping = value

Property Value

Type: TextWrapping Enumeration

One of the enumeration values that indicates how the object should wrap text.

This property is read/write. The default value is NoWrap.

Managed Equivalent

TextWrapping; TextWrapping

Remarks

The TextWrapping property indicates how text should wrap in a text container. The TextWrapping enumeration defines two values: NoWrap and Wrap.

ActualHeight and ActualWidth are read-only properties that report the rendered height and width of the TextBlock; these properties can be different from the Height and Width properties of the TextBlock.

Example

The following XAML example shows how to set the TextWrapping property to NoWrap and 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
  Canvas.Top="40"
  Text="The quick red fox jumped over the lazy brown dog."
  Width="200"
  TextWrapping="Wrap" />

Applies To

TextBlock, TextBox (Silverlight 2)