tags:

views:

539

answers:

1

The following textblock wraps and trims as expected. The elipsis "..." is displayed when the text is trimmed.

<TextBlock 
    MaxWidth="60" 
    MaxHeight="60" 
    Text="This is some long text which I would like to wrap."
    TextWrapping="Wrap" 
    TextTrimming="CharacterEllipsis" />

I would like to display a tooltip over the text with the full text, but only if the text is trimmed. I'm not sure how to reliably determine if the "..." is being shown or not.

How do I determine if the text is being trimmed or not?

+5  A: 

I haven't done a lot of WPF lately, so I'm not sure if this is what you're looking for, but check out this article: Customizing “lookful” WPF controls – Take 2. It's a bit complex, but it seems to address the same question you're asking.

Alek Davis
The algorithm mentioned in the article above is exactly what I was looking for - thanks!
Andrew Jackson