Pre loader

VerticalLineAnnotation DragDeltaCommand command parameter

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums


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.