Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

Detecting TextTrimming="WordEllipsis" on a TextBlock RSS

4 replies

Last post Jan 06, 2011 09:27 AM by ColinE

(0)
  • metal

    metal

    Contributor

    4753 Points

    794 Posts

    Detecting TextTrimming="WordEllipsis" on a TextBlock

    Sep 08, 2010 03:39 PM | LINK

    Text Trimming on TextBlock is great.

    How can I detect if a TextBlock has trimmed its content ?

    Then I can have the visibility of a "click here to read complete text" link underneth.

  • FuryDiamond

    FuryDiamond

    All-Star

    23993 Points

    4100 Posts

    Re: Detecting TextTrimming="WordEllipsis" on a TextBlock

    Sep 08, 2010 03:41 PM | LINK

    That's a great question.  For our scenarios, we had tooltips that rendered the wrapped text but it would be good to know when the TextBlock has trimmed the text. 

     

    Maybe this might help:

    http://tranxcoder.wordpress.com/2008/10/09/showing-tooltips-on-a-trimmed-textblock-wpf/

    Please "Mark as Answer" if this post answered your question. :)

    Silverlight 5 3D Tutorials: http://silverlight.bayprince.com
    Blog: http://blog.bayprince.com
    Twitter: http://twitter.com/bayprince
  • metal

    metal

    Contributor

    4753 Points

    794 Posts

    Re: Detecting TextTrimming="WordEllipsis" on a TextBlock

    Sep 08, 2010 05:21 PM | LINK

    Unfortunately I had already come accross that and it relies on triggers that Silverlight does not support.

  • sladapter

    sladapter

    All-Star

    43609 Points

    7910 Posts

    Re: Detecting TextTrimming="WordEllipsis" on a TextBlock

    Sep 08, 2010 06:23 PM | LINK

    Silverlight does support Triggers.

    But Silverlight TextBlock is a sealed class (don't know why they seal it), so you can not inherit from it and extend the functionality like you can do in WPF to make that EnhancedTextBlock.





    Sally Xu
    Software Engineer
    Aprimo, Inc

    Please remember to mark the replies as answers if they answered your question
  • ColinE

    ColinE

    Member

    19 Points

    17 Posts

    Re: Detecting TextTrimming="WordEllipsis" on a TextBlock

    Jan 06, 2011 09:27 AM | LINK

    A bit of a later reply, however, I have just posted a solution to this problem on my blog:

    http://www.scottlogic.co.uk/blog/colin/2011/01/showing-tooltips-on-trimmed-textblock-silverlight/

    Colin E.