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

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.

SciChart WPF v6 BETA released! Note pricing/licensing changes are coming. Contact us to beat the rise!Read more
+