text block how to do 1. text trimming 2. vertical alignment for windows phone
text block how to do:
- text trimming for a given height
- vertical alignment
Can we use mytextBlock.TextTriming to trim the text? I have tried to trim text with specifying height but its not working same with the vertical alignment.
I triedTextAlignment = center
but its alignin开发者_如何学JAVAg text horizontally.Text trimming is not supported in the current version of the framework. However, Robby Ingebretsen's TextTrimming TextBlock for Silverlight works if you recompile it for WP7.
To align the TextBlock vertically you can do this:
<TextBlock VerticalAlignment="Center" ... />
and ensure that you have the same (or no) margin top and bottom.
You have to add 2 attributes for text trimming for a particular height TextWrapping="Wrap" TextTrimming="Ellipsis"
Along with this you need width or maxwidth value for text wrap to work
精彩评论