开发者

Reusing a tooltip for several textboxes

What should I write in the value of the Text property of the tooltip resource so it would show the text of each textblock dynamically ?

 <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 Te开发者_StackOverflow中文版xt="Jenny" ToolTip="{StaticResource tooltiptemplate}"/>
</StackPanel>


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜