Search code examples
c#wpftooltipinfragisticsxamdatachart

Make tooltip area bigger than the control


I have a chart with thin lines as markers which the user can hover over to get their values.

I would like to make the area in which the tooltip activates bigger but keep the actual line the same size as it is quite difficult for the use to actually hover over.

I also have one line that the user can drag around and it is very difficult to get the precise spot to click and drag.

This is my template for the marker but I am not sure how to accomplish this goal, can anyone point me in the right direction?

<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>
  • Visual Studio 2015
  • WPF
  • C#
  • Infragistics XamDataChart

Solution

  • If I understand you correctly, you just want to show tooltip inside your rectangle represented by Path. If so you can just wrap your path in transparent border and set tooltip on border:

        <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>