Pre loader

Annotation Creation Click Drag instead of two clicks

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
2
0

Hi, in the Dynamically Create Annotations demo, the method on how annotations are created is by (for example a line):

1) First Click on the annotation button
2) Click on the SciChart Surface. This creates the first point of a line
3) Click again on the end point of the line.

Instead of having to do two clicks, is there a way to click and drag instead? eg.

1) First Click on the annotation button
2) Click on the SciChart Surface. This creates the first point of a line
3) drag to the end point of the line.

I just want to mimic Microsoft power point behaviour as our users are more familiar with it.

Thanks

  • You must to post comments
Best Answer
1
0

This is useful, our users also complained about the nonstandard two click process to add annotations. However using this modification causes a crash upon adding HorizontalLineAnnotation and VerticalLineAnnotation, and TextAnnotation does not work either. As these annotations work fine with 1 click, there is an easy workaround for this of course:

public class CustomAnnotationCreationModifier : AnnotationCreationModifier
{
    public override void OnModifierMouseDown(ModifierMouseArgs e)
    {
        if (AnnotationType != typeof (TextAnnotation)
            && AnnotationType != typeof (HorizontalLineAnnotation)
            && AnnotationType != typeof (VerticalLineAnnotation))
        {
            OnModifierMouseUp(e);
        }
    }
}
  • You must to post comments
1
0

Hi Azrin,

Thanks for writing to us. To achive desired behavior please try to create custom AnnotationCreationModifier with next code:

public class CustomAnnotationCreationModifier : AnnotationCreationModifier
{
    public override void OnModifierMouseDown(ModifierMouseArgs e)
    {
        OnModifierMouseUp(e);
    }
}

By default AnnotationCreationModifier uses only mouse up event. When first mouse up occurs – modifier creates and places annotation, on second mouse up – annotation is fully created and AnnotationCreated event fires. With provided code – annotation is created when mouse down occurs and AnnotationCreated event is raised on mouse up event.

Is this approach suitable for you? Hope it helps!

  • You must to post comments
0
0

@Click test I have an MS Project with a form that is a button, I want to click and drag from the All Forms window and drag it up to the toolbar. How can you click on an item and then drag and drop?

  • You must to post comments
Showing 3 results
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