How to judge text block is trimming with ... I have set text block TextTrimming property to WordEllipsis. And i only want to show tooltip when the text block does not show the whole text.<br>Currently, i used the following mehtod,  but the precision is not too good.<br><br> <div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:Courier New;background-color:white"> <table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" cellspacing=0 cellpadding=0> <colgroup> <col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:Courier New;white-space:nowrap"> <tbody> <tr> <td><font style="font-size:11px">FormattedText </font><font style="color:red">fText</font><font style="font-size:11px"> = </font><font style="color:blue">new</font><font style="font-size:11px"> FormattedText(txtBlock.Text, System.Globalization.CultureInfo.CurrentUICulture, FlowDirection.LeftToRight,  </font></td></tr> <tr> <td style="background-color:#f7f7f7">                    new Typeface(txtBlock.FontFamily, txtBlock.FontStyle, txtBlock.FontWeight, txtBlock.FontStretch), txtBlock.FontSize, Brushes.Black);  </td></tr> <tr> <td>Rect </font><font style="color:red">desiredRect</font><font style="font-size:11px"> = </font><font style="color:blue">fText</font><font style="font-size:11px">.BuildGeometry(new Point(0, 0)).Bounds;  </font></td></tr> <tr> <td style="background-color:#f7f7f7">double </font><font style="color:red">desiredWidth</font><font style="font-size:11px"> = </font><font style="color:blue">desiredRect</font><font style="font-size:11px">.Width + (txtBlock.ActualHeight - desiredRect.Height) - 1;  </font></td></tr> <tr> <td> </td></tr> <tr> <td style="background-color:#f7f7f7">if (desiredWidth </font><font style="color:blue">&gt;</font><font style="font-size:11px"> txtBlock.ActualWidth)  </font></td></tr> <tr> <td>{  </td></tr> <tr> <td style="background-color:#f7f7f7">     //...  </td></tr> <tr> <td>} </td></tr></tbody></table></div> <br><br><hr size="1" align="left" width="25%">anders06© 2009 Microsoft Corporation. All rights reserved.Fri, 05 Sep 2008 09:20:38 Z4406e828-bee1-49fb-a26a-3128a18e0595http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/4406e828-bee1-49fb-a26a-3128a18e0595#4406e828-bee1-49fb-a26a-3128a18e0595http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/4406e828-bee1-49fb-a26a-3128a18e0595#4406e828-bee1-49fb-a26a-3128a18e0595anders06http://social.msdn.microsoft.com/Profile/en-US/?user=anders06How to judge text block is trimming with ... I have set text block TextTrimming property to WordEllipsis. And i only want to show tooltip when the text block does not show the whole text.<br>Currently, i used the following mehtod,  but the precision is not too good.<br><br> <div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:Courier New;background-color:white"> <table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" cellspacing=0 cellpadding=0> <colgroup> <col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:Courier New;white-space:nowrap"> <tbody> <tr> <td><font style="font-size:11px">FormattedText </font><font style="color:red">fText</font><font style="font-size:11px"> = </font><font style="color:blue">new</font><font style="font-size:11px"> FormattedText(txtBlock.Text, System.Globalization.CultureInfo.CurrentUICulture, FlowDirection.LeftToRight,  </font></td></tr> <tr> <td style="background-color:#f7f7f7">                    new Typeface(txtBlock.FontFamily, txtBlock.FontStyle, txtBlock.FontWeight, txtBlock.FontStretch), txtBlock.FontSize, Brushes.Black);  </td></tr> <tr> <td>Rect </font><font style="color:red">desiredRect</font><font style="font-size:11px"> = </font><font style="color:blue">fText</font><font style="font-size:11px">.BuildGeometry(new Point(0, 0)).Bounds;  </font></td></tr> <tr> <td style="background-color:#f7f7f7">double </font><font style="color:red">desiredWidth</font><font style="font-size:11px"> = </font><font style="color:blue">desiredRect</font><font style="font-size:11px">.Width + (txtBlock.ActualHeight - desiredRect.Height) - 1;  </font></td></tr> <tr> <td> </td></tr> <tr> <td style="background-color:#f7f7f7">if (desiredWidth </font><font style="color:blue">&gt;</font><font style="font-size:11px"> txtBlock.ActualWidth)  </font></td></tr> <tr> <td>{  </td></tr> <tr> <td style="background-color:#f7f7f7">     //...  </td></tr> <tr> <td>} </td></tr></tbody></table></div> <br><br><hr size="1" align="left" width="25%">anders06Thu, 28 Aug 2008 08:29:39 Z2008-08-28T08:29:39Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/4406e828-bee1-49fb-a26a-3128a18e0595#d950d5e4-681e-4461-a8e0-a7cf0e53b738http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/4406e828-bee1-49fb-a26a-3128a18e0595#d950d5e4-681e-4461-a8e0-a7cf0e53b738anders06http://social.msdn.microsoft.com/Profile/en-US/?user=anders06How to judge text block is trimming with ... Any suggestion?<hr size="1" align="left" width="25%">anders06Mon, 01 Sep 2008 10:55:44 Z2008-09-01T10:55:44Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/4406e828-bee1-49fb-a26a-3128a18e0595#2f6cebf8-a857-4457-a68f-e53aee5940d3http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/4406e828-bee1-49fb-a26a-3128a18e0595#2f6cebf8-a857-4457-a68f-e53aee5940d3Marco Zhouhttp://social.msdn.microsoft.com/Profile/en-US/?user=Marco%20ZhouHow to judge text block is trimming with ...I think you could use the following extension method to determine if a specified TextBlock has been trimmed without calling BuildGeometry() to get the size of the underlying geomtrical metrics which could be different from my personal experience:<br><br>public static class TextBlockExtensions<br>{<br>    public static Boolean IsTextTrimmed(this TextBlock textBlock)<br>    {<br>        Typeface typeface = new Typeface(textBlock.FontFamily,<br>            textBlock.FontStyle,<br>            textBlock.FontWeight,<br>            textBlock.FontStretch);<br><br>        // FormattedText is used to measure the whole width of the text held up by TextBlock container.<br>        FormattedText formmatedText = new FormattedText(<br>            textBlock.Text,<br>            System.Threading.Thread.CurrentThread.CurrentCulture,<br>            textBlock.FlowDirection,<br>           typeface,<br>            textBlock.FontSize,<br>            textBlock.Foreground);<br><br>        return formmatedText.Width &gt; textBlock.Width;<br>    }<br>}<br> Tue, 02 Sep 2008 06:18:35 Z2008-09-02T06:18:35Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/4406e828-bee1-49fb-a26a-3128a18e0595#657871d9-ebcd-4826-9768-e2c712505f28http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/4406e828-bee1-49fb-a26a-3128a18e0595#657871d9-ebcd-4826-9768-e2c712505f28anders06http://social.msdn.microsoft.com/Profile/en-US/?user=anders06How to judge text block is trimming with ... Thanks, Marco.<br>It works so perfect.<br><br>And it should be &quot;return  formmatedText.Width &gt; textBlock.<font style="background-color:#ffcccc">ActualWidth</font>;“  :)  <br><hr size="1" align="left" width="25%">anders06Fri, 05 Sep 2008 09:20:38 Z2008-09-05T09:20:38Z