[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Gets or sets the text trimming behavior to employ when content overflows the content area.
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
This example demonstrates the usage and effects of the values available in the TextTrimming enumeration.
The following example defines a TextBlock element with the attribute set.
<TextBlock Name="myTextBlock" Margin="20" Background="LightGoldenrodYellow" TextTrimming="WordEllipsis" TextWrapping="NoWrap" FontSize="14" > One<LineBreak/> two two<LineBreak/> Three Three Three<LineBreak/> four four four four<LineBreak/> Five Five Five Five Five<LineBreak/> six six six six six six<LineBreak/> Seven Seven Seven Seven Seven Seven Seven </TextBlock>
Setting the corresponding TextTrimming property in code is demonstrated below.
There are currently three options for trimming text: CharacterEllipsis, WordEllipsis, and None.
When is set to CharacterEllipsis, text is trimmed and continued with an ellipsis at the character closest to the trimming edge. This setting tends to trim text to fit more closely to the trimming boundary, but may result in words being partially trimmed. The following figure shows the effect of this setting on a TextBlock similar to the one defined above.
When is set to WordEllipsis, text is trimmed and continued with an ellipsis at the end of the first full word closest to the trimming edge. This setting will not show partially trimmed words, but tends not to trim text as closely to the trimming edge as the CharacterEllipsis setting. The following figure shows the effect of this setting on the TextBlock defined above.
When is set to None, no text trimming is performed. In this case, text is simply cropped to the boundary of the parent text container. The following figure shows the effect of this setting on a TextBlock similar to the one defined above.
Windows 8 Consumer Preview, Windows Server 8 Beta, Windows 7, Windows Server 2008 SP2, Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.