Binding to control properties in tooltips

I want to display some properties of a label (custom) in its tooltip, but I can't get it to work correctly, so there must be 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?

+1


a source to share


1 answer


I found a 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/

+3


a source







All Articles