Windows Phone 8.1 and Windows Runtime Apps How to #14 – Text Trimming for TextBlock Element.

The Text Trimming described how a text can be trimmed when it exceeds the width of the current text block .

In Windows Phone 8.1 , the TextBlock has the property TextTrimming that allows the developers to trim the text in 4 different ways.

This property takes one of the TextTrimming enum values

  • None
  • WordEllipsis
  • CharacterEllipsis
  • Clip

For example , the TextTrimming property can be set like the way shown in the below XAML code snippet.

<TextBlock TextTrimming="WordEllipsis"  Width="75px" MaxHeight=”400px” >Welcome to developerpublish.com</TextBlock>

When the TextTrimming is set to “None” , the Text is not trimmed .

image

When the TextTrimming is set to “WordEllipsis” , the text is trimmed at a word boundary and an ellipsis is written in the end.

image

When the TextTrimming is set to CharacterEllipsis , the text is trimmed at a character boundary and an ellipsis is written in the end. This feature was introduced from Windows Phone 8.1(Windows Runtime App) or Windows 8.1.

image

When the TextTrimming is set to “Clip” , the text is trimmed without drawing an ellipsis . image

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

This blog post will guide you through several effective methods to troubleshoot and resolve the issue of Microsoft Edge not...
Windows 11 offers a range of audio enhancements that can enrich your listening experience. These enhancements include features like virtual...
Windows 11 brings a fresh and visually stunning design to your desktop, and one of the standout features is the...