Resource

Wrap text in a WPF Label

XAML Designer Resources Dec 16, 2009
In WPF, the Label control does not support text wrapping. If you need a label that wraps contents across multiple lines, you can use a TextBlock control.

In WPF, the Label control does not support text wrapping. If you need a label that wraps contents across multiple lines, you can use a TextBlock control. Place a TextBlock control inside a Label and apply wrapping on TextBlock.

The following example shows how to use a TextBlock to make a label that wraps several lines of text.

<Label Name="Label1" Width="200" HorizontalAlignment="Left">
<TextBlock TextWrapping="WrapWithOverflow">
This is a Label with text wrapping feature. If text does not fit in a single line,
It will move to next line.
</TextBlock>
</Label>
post comment
     
COMMENT USING
PREMIUM SPONSORS
Over-C is a holistic consortium of communications and technology specialists. We build, deploy and market both business as well as consumer products and solutions.
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Get Career Advice from Experts