2010-11-29 14 views
1

Que dois-je écrire dans la valeur de la propriété Text de la ressource d'info-bulle afin qu'elle affiche dynamiquement le texte de chaque bloc de texte?Réutilisation d'une info-bulle pour plusieurs zones de texte

<StackPanel x:Name="root"> 
    <StackPanel.Resources> 
     <ResourceDictionary> 

      <ToolTip x:Key="tooltiptemplate"> 
       <TextBlock Background="LightBlue" TextTrimming="WordEllipsis" Text="?????"/> 
      </ToolTip> 

     </ResourceDictionary> 
    </StackPanel.Resources> 

    <TextBlock Text="Mickel" ToolTip="{StaticResource tooltiptemplate}"/> 
    <TextBlock Text="Kim" ToolTip="{StaticResource tooltiptemplate}"/> 
    <TextBlock Text="Jenny" ToolTip="{StaticResource tooltiptemplate}"/> 
</StackPanel> 

Répondre

2
{Binding PlacementTarget.Text, RelativeSource={RelativeSource AncestorType={x:Type ToolTip}}}