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!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.



How can I capture an event (mouse event or something like that) in my ViewModel after zooming or panning the chart.


  • You must to post comments
Best Answer

Hi again,

Please, take a look on this example:

                <SciChart:NumericAxis AxisTitle="Time (ms)"
                                      VisibleRange="{Binding XVisibleRange,
                        <i:EventTrigger EventName="VisibleRangeChanged">
                            <local:ExecuteCommandAction Command="{Binding OnVisibleRangeChanged}" />

ExecuteCommandAction class:

    public class ExecuteCommandAction : TriggerAction<Control>
        public static readonly DependencyProperty CommandProperty =
            DependencyProperty.Register("Command", typeof(ICommand), typeof(ExecuteCommandAction), new PropertyMetadata(null));

        public ICommand Command
            get { return (ICommand)GetValue(CommandProperty); }
            set { SetValue(CommandProperty, value); }

        protected override void Invoke(object parameter)
            if(Command != null && Command.CanExecute(null))

Could you try out this approach and give us a feedback if this is what you want?


  • EJansen
    Hi,Thanks, it works great now. Your first answer already gave me the solution.We are using the following xaml code:
                    <SciChart:SciChartSurface Grid.Column="0" Grid.Row="0" x:Name="sciChartSurface" 
                                          DataSet="{Binding ChartData, Mode=TwoWay}"
                                          RenderableSeries="{Binding RenderableSeries}"
                                          SciChart:ThemeManager.Theme="{Binding SciChartTheme}"
                                          XAxis="{Binding XAxis}" 
                                          YAxes="{Binding YAxes}"
                                          Annotations="{Binding Annotations}"
                                          ChartModifier="{Binding ChartModifier}" >
    In the ViewModel we are using:this.XAxis.VisibleRangeChanged += new EventHandler(VisibleRangeChangedEvent); and the same for the Yaxes
  • You must to post comments

Hi there,

When you zoom or pan a chart, VisibleRange changed and VisibleRangeChanged event fired on axes. So you could bind this event to command in your ViewModel using EventTriggers and InvokeCommandAction.

Please, feel free to ask if you have any questions!

Best regards,

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.