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

Answered
0
0

VerticalLineAnnotation has

public event EventHandler<AnnotationDragDeltaEventArgs> DragDelta

It comes with an EventArgs. https://www.scichart.com/documentation/v5.x/webframe.html#SciChart.Charting~SciChart.Charting.Visuals.Annotations.VerticalLineAnnotation_members.html

VerticalLineAnnotation also has

public ICommand DragDeltaCommand {get; set;}

How can I pass AnnotationDragDeltaEventArgs into DragDeltaCommand ?

Thanks.

Version
5.4.0.12119
  • You must to post comments
Best Answer
0
0

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.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies