Events in WPF Diagram (SfDiagram)
5 May 20211 minute to read
The AnnotationChanged event will notify the annotation related actions and value changes. The AnnotationChangedEventArgs
class is used to get or set the entire annotation related properties and their values.
//Register the AnnotationChanged event
(diagram.Info as IGraphInfo).AnnotationChanged += Diagram_AnnotationChanged;
//Method to show message box when annotation is changed
private void Diagram_AnnotationChanged(object sender, ChangeEventArgs<object, AnnotationChangedEventArgs> args)
{
//When annotation is resized
if (args.NewValue.AnnotationInteractionState == AnnotationInteractionState.Resized)
{
MessageBox.Show("Annotation has been resized!");
}
//When annotation is resized
if (args.NewValue.AnnotationInteractionState == AnnotationInteractionState.Rotated)
{
MessageBox.Show("Annotation has been rotated!");
}
//When annotation is resized
if (args.NewValue.AnnotationInteractionState == AnnotationInteractionState.Edited)
{
MessageBox.Show("Annotation has been edited!");
}
}