# Mouse Interaction Chart Panel

## Content



The **ChartPanel** has support of mouse interaction. The [ChartPanelAction](/componentone/api/wpf/online-chart/dotnet-framework-api/C1.WPF.C1Chart.4.6.2/C1.WPF.C1Chart.ChartPanelAction.html) enumeration specifies possible action for the chart panel objects. The **ChartPanelAction** enumeration includes the following members:

Using the [Action](/componentone/api/wpf/online-chart/dotnet-framework-api/C1.WPF.C1Chart.4.6.2/C1.WPF.C1Chart.Action.html) property we can make a draggable element or element that follows the mouse pointer. For example, adding **Action** to the previous sample we get the marker that can be moved by user.

```xml
<!-- vertical line -->
   <c1chart:ChartPanelObject DataPoint="0,NaN" VerticalAlignment="Stretch"
       Action="LeftMouseButtonDrag" >
     <Border BorderBrush="Red" BorderThickness="3,0,0,0"
Margin="-1.5,0,0,0" />
   </c1chart:ChartPanelObject>
```

Using data binding it's easy to add label that shows the current coordinate:

```xml
<!-- vertical line with coordinate label -->
 <c1chart:ChartPanelObject x:Name="xmarker" DataPoint="0,NaN"
VerticalAlignment="Stretch"
     Action="LeftMouseButtonDrag">
   <Border BorderBrush="Red" BorderThickness="3,0,0,0"
Margin="-1.5,0,0,0" >
     <TextBlock
       Text="{Binding RelativeSource={RelativeSource Self},
         Path=Parent.Parent.DataPoint.X,StringFormat='x=0.0;x=-0.0'}" />
     </Border>
 </c1chart:ChartPanelObject>
```

The property Attach allows to stick the possible positions of the element to the nearest data point. It can be attached to the single coordinate(X or Y) or both coordinates (XY).

## See Also

[Multiple Plot Areas](/componentone/docs/wpf/online-chart/overview/ChartFeatures/MultiplePlotAreas)