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

In this post, you’ll learn about the Win32 Error “0x000019E5 – ERROR_COULD_NOT_RESIZE_LOG” that you get when debugging system erors in...
In this post, you’ll learn about the error “CO_E_DBERROR 0x8004E02B” that is returned when working with COM based APIs or...
In this post, you’ll learn about the Win32 Error “0x000019D0 – ERROR_LOG_BLOCK_VERSION” that you get when debugging system erors in...