开发者

WPF: Tooltip on the fill of a 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.

Is there any other way?

EDIT: The path is and should be filled. The toolt开发者_JS百科ip should popup on the path outline and on the filled area inside.


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="..."  />


If you are creating the path dynamically, you can set like this:

Path p = new Path();
........
.......
p.Fill = new SolidColorBrush(Colors.Red);
p.SetValue(ToolTipService.ToolTipProperty, "Tooltip is here");
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜