SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
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
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);
}
}
}
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!
@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?
Please login first to submit.