Between keeping up with what’s coming for .Net 4.0 as well as the end of a large DOD contract I’ve been a bit busy (and no developer fatigue, just busy :)). But don’t fret loyal readers, more will be coming soon.

Until then here is a bit of xaml for self-referencing bindings.

<TextBlock
  Grid.Column="1"
  Width="75" 
  Foreground="{StaticResource ActiveTabForeground}"
  TextWrapping="NoWrap" 
  TextTrimming="CharacterEllipsis" 
  ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}"     
  Name="txtHeader"/>

As you can see I often use these with TextBlocks where I’m using text trimming. The reason being that, with text trimming, the text gets cut short if it exceeds the width of the textblock. This way users will be able to mouse over the textblock and get the tooltip containing the full value.

Where else would this be useful? Well, um, I don’t know since I only use this with tooltips on TextBlocks. But it is certainly helpful for that.

Enjoy,
Brian

Leave a Reply

Your email address will not be published. Required fields are marked *

FormatException

928 East Plymouth Drive Asbury Park, NJ 07712