views:

181

answers:

1

Hi,

I want to display some properties of a (custom) Label in its Tooltip, but I can't seem to get it working correctly so must be doing something wrong:

<Label.ToolTip>
    <Border BorderBrush="Gray" CornerRadius="5" Margin="5" Padding="5">
       <Label Content="{Binding Path=Width, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Label}}}"/>  
    </Border>
</Label.ToolTip>

Any ideas?

+2  A: 

I've found the solution

<ToolTip  DataContext="{Binding Path=PlacementTarget, RelativeSource={x:Static RelativeSource.Self}}">

Thnx to Karl!

http://karlshifflett.wordpress.com/2007/12/29/wpf-sample-series-data-binding-in-tooltip/

TimothyP