WPF,ToolTip工具提示的位置怎么没对啊

dgfm4 dgfm4 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

<Window x:Class="WPF1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WPF1"
Title="MainWindow" Height="550" Width="825">
<Grid>
<Ellipse Height="25" Width="50" Fill="Gray" HorizontalAlignment="Left">
<Ellipse.ToolTip>
<ToolTip Placement="Right" PlacementTarget="{Binding ElementName=Button2}" HorizontalOffset="50" VerticalOffset="-70" HasDropShadow="false">
张三
</ToolTip>
</Ellipse.ToolTip>
</Ellipse>
<Button Name="Button2" Content="Button2" HorizontalAlignment="Left" Margin="130,354,0,0" VerticalAlignment="Top" Width="74"/>
</Grid>
</Window>



上面的代码中,设置了ToolTip 的Placement属性值为Right,PlacementTarget值为Button2,然后又设置了HorizontalOffset和VerticalOffset值。那当鼠标移到Ellipse 上时,提示框的弹出位置就应该是以Button2的位置来计算的吧。
可是,为什么结果提示框的弹出位置还是以Ellipse的位置来进行计算的呢?
...全文
评论 12
收藏 已收藏
分享
返回顶部
dgfm4
C# 111,129 成员 642,538 内容