SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on where you can earn rep for your questions!


Hi all,

As the title indicates, I am trying to get mouse cursor position (Coordinates) from a SciChartSurface in MVVM manner.

I have lots of data bindings to my chart properties in my View Model in the background. This following snipped is a copy of my XAML code in which I have all the data bindings set:

<sci:SciChartSurface Grid.Row="0" Grid.Column="0"
                         RenderableSeries="{Binding SciChartSeriesViewModels}"     
                         YAxes="{Binding SciChartYAxesCollection,Mode=TwoWay}"                                         
                         Annotations="{Binding ChartAnnotations}"                                     
                         ChartModifier ="{Binding ChartModifierGroup}"
                         Visibility="{Binding ChartVisibility}">

            <sci:TimeSpanAxis AxisTitle="Time"
                              AutoRange="Once" GrowBy="0.03,0.001"


As can be seen from the code above, the ChartModifier property is one of the items that has Data binding to an instance of a ModiferGroup I have created in my View-Model in the background. The following code is a method that adds members to that ModiferGroup (called ChartModiferGroup in my View-Model):

 private void CreateChartModifiers()
        var rubberBandXyZoomModifier = new RubberBandXyZoomModifier
            ExecuteOn = SciChart.Charting.ChartModifiers.ExecuteOn.MouseLeftButton,
            RubberBandFill = (SolidColorBrush)(new BrushConverter().ConvertFrom("#33FFFFFF")),
            RubberBandStroke = Brushes.SteelBlue, 
            RubberBandStrokeDashArray = new DoubleCollection {2.0, 2.0}

        var zoomPanModifier = new ZoomPanModifier
            ExecuteOn = SciChart.Charting.ChartModifiers.ExecuteOn.MouseMiddleButton,
            ClipModeX = SciChart.Charting.ClipMode.None

        var yAxisDragModifier = new YAxisDragModifier
            DragMode = SciChart.Charting.AxisDragModes.Scale

        var xAxisDragModifier = new XAxisDragModifier
            DragMode = SciChart.Charting.AxisDragModes.Pan

        var mouseWheelZoomModifier = new MouseWheelZoomModifier();

        var zoomExtentsModifier = new ZoomExtentsModifier
            ExecuteOn = SciChart.Charting.ChartModifiers.ExecuteOn.MouseDoubleClick

        var cursorModifier = new CursorModifier
            ReceiveHandledEvents = true,
            ShowAxisLabels = false

        var probeline = new VerticalLineAnnotation()
            Stroke = Brushes.LightSlateGray,
            IsEditable = true,
            ShowLabel = true,
            LabelPlacement = LabelPlacement.Axis,
            Visibility = Visibility.Visible,
            IsHidden = false,
            IsEnabled = true,
            X1 = TimeSpan.FromMilliseconds(-100),
            YAxisId = "Triggered",
            StrokeDashArray = new DoubleCollection { 2.0,2.0},
            StrokeThickness = 1

        var verticalSliceModifier = new VerticalSliceModifier
            IsEnabled = true,
            ShowAxisLabels = true,
            Style = probeline.Style


What I am trying to do next, is to add functionality in my application, such that I can add more VerticalSliceModifiers to my ChartModifierGroup when a button is pressed. In order to do that, I will require having access to the Mouse cursor position of my SciChartSurface to set the X1 property of the VerticalLineAnnotation, that would be used for the VerticalSliceModifiers (to be created).

In simple words, every time I press a button, I need the position of the mouse pointer to get captured and used as the location of the new VerticalSliceModifer that I am going to create.

I have already read many of the examples and documentation of Sci-Chart such as: Vertical Slice Tooltips Example. However, in this example, the mouse pointer location is accessed is under the xaml.cs and not inside an actual View-Model.

I was wondering if anybody could let me know how I can get access to my SciChartSurface mouse pointer position using true MVVM model.

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.