Automatically Showing ToolTips on a Trimmed TextBlock (Silverlight) - by Colin E.
Silverlight 4 added TextTrimming=”WordEllipsis”, which trims the text that a TextBlock displays based on the available width. This blog post describes a simple method for automatically showing the full text as a tooltip whenever the text is trimmed. This is presented as an attached behaviour.
The TextTrimming feature of SL4 allows us to worry a little less about the layout of our applications, giving the option to use fixed widths when rendering text. This can be particularly useful if you have to localize your application. However, arbitrarily trimming the text without providing the user with a mechanism to see the full text is not great for the user. A simple solution is to use a tooltip to present the full text.
Detecting whether the a TextBlock’s text is being trimmed is not something that is available from the TextBlock’s API, there is no IsTrimmed property! A quick search of the Silverlight forums drew a dead end. I did find a decent WPF solution, however this uses various parts of the WPF API that are not present in Silverlight.
Read More from: Original Source
Post Contributed by: Kunal Chowdhury
Kunal is the Site Admin and Contributor of Silverlight-Zone. He is a Software Engineer, Microsoft Silverlight MVP, Code Project Mentor and a Code Project MVP. He is also an active Author in SilverlightShow.net and a speaker in various community events. He works on Microsoft Platform and very passionate about Silverlight technology. He started his career in 2007 and achieved various awards during his professional life.
He shares his findings in his personal blog: http://www.kunal-chowdhury.com and he also tweets at: @kunal2383.