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.
- Hao Zeng asked 5 years ago
- You must login to post comments
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
- Andrew Burnett-Thompson answered 5 years ago
-
thanks for the information. It works
-
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 login to post comments
Please login first to submit.