WPF:路径填充上的工具提示 [英] WPF: Tooltip on the fill of a Path

查看:60
本文介绍了WPF:路径填充上的工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为System.Windows.Shape.Path分配工具提示.

I want to assign a tooltip to a System.Windows.Shape.Path.

当我触摸路径的轮廓时会弹出工具提示,但是当我进入路径的填充部分时却没有工具提示.

While the tooltip pops up when I touch the outline of the path I get no tooltip when I am inside the filled part of the path.

我可以以某种方式更改此行为吗? 我唯一的想法是将路径添加到画布等其他控件,并将工具提示分配给画布.但这似乎是很多工作.

Can I change this behavior in some way? My only idea was to add the path to an additional control like a canvas and assign the tooltip to the canvas. But that seems to be a lot of work.

还有其他方法吗?

路径是并且应该被填充.工具提示应在路径轮廓和内部填充区域上弹出.

The path is and should be filled. The tooltip should popup on the path outline and on the filled area inside.

推荐答案

如果您尚未设置Fill属性,则您期望的行为是正常的.如果仅需要轮廓"路径,请考虑将填充"属性设置为透明".

If you have not set the Fill property, the behavior you have is expected. Consider setting the Fill property to Transparent if you simply want an "outline" Path.

<Path Fill="Transparent" 
      ToolTip="My Tooltip" 
      Data="..." Stroke="..." StrokeThickness="..."  />

这篇关于WPF:路径填充上的工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆