开发者

Reusing a tooltip for several textboxes

开发者 https://www.devze.com 2023-01-27 05:28 出处:网络
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 ?

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

精彩评论

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