我有一个带有细线作为标记的图表,用户可以将其悬停以获取其值。
我想使工具提示激活的区域更大,但要使实际线条的大小保持相同,因为实际使用时很难将鼠标悬停在上面。
我还有一条线可供用户拖动,很难获得准确的位置来单击和拖动。
这是我的标记模板,但是我不确定如何实现此目标,有人可以指出正确的方向吗?
<Geometry x:Key="LineGeometry">M 0,0 L 5,0 L 5,15 L 0,15 Z</Geometry>
<DataTemplate>
<!-- Define the template for the actual markers -->
<Path Width="10"
Height="10"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Data="{StaticResource LineGeometry}"
Stretch="Fill"
Stroke="{StaticResource BlackBrush}"
StrokeThickness="0.5">
<Path.ToolTip>
<!-- Lots of tooltip definition stuff -->
</Path.ToolTip>
</Path>
</DataTemplate>
如果我对您的理解正确,那么您只想在由Path表示的矩形内显示工具提示。如果是这样,您可以将路径包装在透明边框中,并在边框上设置工具提示:
<Border Background="Transparent">
<Path Width="10"
Height="10"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Data="{StaticResource LineGeometry}"
Stretch="Fill"
Stroke="Black"
StrokeThickness="0.5"></Path>
<Border.ToolTip>
<TextBlock Text="Tooltip" />
</Border.ToolTip>
</Border>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句