| |
First let me say thanks for stopping by my site. My name is David Hanson-Graville and I am a IT consultant working in the UK. Let me make it clear, I am passionate about technology and specifically .net and its various forms. I've programmed in a range of langages, but I can say, I am now at my happiest when coding with c#. I hope my blog is an enjoyable & educational read and please feel free to email me at David.Hanson@OnTheBlog.net if you have any questions.
|
|
|
 |
|
 |
|
Location: Blogs OnTheBlog |
 |
| Posted by: David Hanson |
Thu, 07 Feb 2008 10:49:52 GMT |
Here’s a useful tip for you budding WPF aficionados out there. If there is any chance that the text in a textblock may become truncated (the databound text may not fit or the window may be resized), assuming you don’t want the text to wrap (where you would use the TextWrapping attribute), add the TextTrimming attribute. Your options are None (no ellipse – default), WordEllipse (an ellipse is inserted after the last word that fits) or CharacterEllipse (an ellipse is inserted after the last character that fits).
Example from MSDN
<TextBlock
Name="myTextBlock"
Margin="20" Background="LightGoldenrodYellow"
TextTrimming="CharacterEllipse" 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>
Results in
.png)
Hope it helps. |
|
| Permalink |
Trackback |
Comments (3)
Add Comment
|
Re: WPF text trimming |
By Eric on
Wed, 23 Sep 2009 06:14:01 GMT |
| It's great! Thanks |
|
|
Re: WPF text trimming |
By Kelmen on
Mon, 14 Dec 2009 09:31:03 GMT |
| is there a way to detect when the text is being trimmed? |
|
|
Re: WPF text trimming |
By host on
Mon, 14 Dec 2009 09:31:11 GMT |
| Yes you can try this. <br><br>http://consultingblogs.emc.com/dariuscollins/archive/2009/11/25/automated-tool-tip-for-textblocks.aspx |
|
|
|
|
|
|
|
|
|
 |
|
 |
|
Twitter / LordHanson
Published Wed, 01 Feb 2012 08:09:05 +0000
by
Published Sun, 29 Jan 2012 11:04:51 +0000
by
Published Fri, 27 Jan 2012 08:41:35 +0000
by
Published Fri, 27 Jan 2012 08:39:44 +0000
by
Published Fri, 27 Jan 2012 08:36:27 +0000
by
Published Thu, 26 Jan 2012 08:35:41 +0000
by
Published Wed, 25 Jan 2012 21:47:45 +0000
by
Published Wed, 25 Jan 2012 21:04:46 +0000
by
Published Wed, 25 Jan 2012 20:32:34 +0000
by
Published Wed, 25 Jan 2012 19:04:02 +0000
by
Published Tue, 24 Jan 2012 22:01:20 +0000
by
Published Tue, 24 Jan 2012 21:47:21 +0000
by
Published Tue, 24 Jan 2012 21:46:17 +0000
by
Published Tue, 24 Jan 2012 21:34:11 +0000
by
Published Mon, 23 Jan 2012 08:33:16 +0000
by
Published Mon, 23 Jan 2012 08:31:37 +0000
by
Published Mon, 23 Jan 2012 08:28:08 +0000
by
Published Mon, 23 Jan 2012 08:24:44 +0000
by
Published Mon, 23 Jan 2012 08:23:18 +0000
by
Published Mon, 23 Jan 2012 08:20:09 +0000
by
|
|
|
|
|
|
|
|
|
 |
|
 |
|
Silverlight - Google News
Published Fri, 03 Feb 2012 13:03:27 GMT
by
Published Mon, 06 Feb 2012 05:59:33 GMT
by
Published Tue, 31 Jan 2012 17:34:58 GMT
by
Published Tue, 31 Jan 2012 17:21:58 GMT
by
Published Sun, 05 Feb 2012 23:15:21 GMT
by
Published Sun, 05 Feb 2012 20:22:31 GMT
by
Published Sun, 05 Feb 2012 17:25:01 GMT
by
Published Fri, 27 Jan 2012 11:00:46 GMT
by
Published Fri, 27 Jan 2012 17:24:53 GMT
by
Published Mon, 16 Jan 2012 17:29:27 GMT
by
|
|
|
|
|
|
|
|
|
|
|
|