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


VerticalLineAnnotation has

public event EventHandler<AnnotationDragDeltaEventArgs> DragDelta

It comes with an EventArgs.

VerticalLineAnnotation also has

public ICommand DragDeltaCommand {get; set;}

How can I pass AnnotationDragDeltaEventArgs into DragDeltaCommand ?


  • You must to post comments
Best Answer

Hi there,

DragDeltaCommand is defined like this in BaseAnnotationViewModel:

    protected BaseAnnotationViewModel()
        DragEndedCommand = new ActionCommand<EventArgs>(OnDragEndedChanged);
        IsHiddenChangedCommand = new ActionCommand(OnIsHiddenChanged);
        DragDeltaCommand = new ActionCommand<AnnotationDragDeltaEventArgs>(OnDragDeltaChanged);
        DragStartedCommand = new ActionCommand<EventArgs>(OnDragStartedChanged);
        UnselectedCommand = new ActionCommand(OnUnselectedChanged);
        SelectedCommand = new ActionCommand(OnSelectedChanged);

    public ICommand DragEndedCommand { get; }
    public ICommand IsHiddenChangedCommand { get; }
    public ICommand DragDeltaCommand { get; }
    public ICommand DragStartedCommand { get; }
    public ICommand UnselectedCommand { get; }
    public ICommand SelectedCommand { get; }

So it calls the method OnDragDeltaChanged in BaseAnnotationViewModel, which in turn raises DragDelta event in BaseAnnotationViewModel.

So the answer should be if you declare a VerticalLineAnnotationViewModel you should be able to simply subscribe to VerticalLineAnnotationViewModel.DragDelta event to be notified when user drags the vertical line.

Let me know if that helps

  • Hao Zeng
    thanks for the information. It works
  • Hao Zeng
    For the completeness of this answer, you can bind DragDeltaCommand to LineMoved_Cmd then doing something like this: private ICommand _lineMoved_Cmd ; public ICommand LineMoved_Cmd { get { return _lineMoved_Cmd ?? (_lineMoved_Cmd = new RelayCommand(Execute_LineMoved_Cmd)); } } private void Execute_LineMoved_Cmd(AnnotationDragDeltaEventArgs args) { … }
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.