2010-11-29 45 views
1

我应该在tooltip资源的Text属性的值中写入什么内容,以便动态显示每个文本块的文本?重复使用多个文本框的工具提示

<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> 

回答

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