Pre loader

Composite annotation with editable text

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

0
0

Hello,

I have created a composite annotation consisting of a Box and a Text Annotations and I need the text to be editable.
I set the TextAnnotation.CanEditText to true, but it doesn’t seem to work. How can I achieve that?

Also, is it possible to allow moving (by dragging) only the Text Annotation inside the composite?

Version
Trial
  • You must to post comments
0
0

Hello Ursu,

Thanks for your inquiry.

The desired behavior is not supported out of the box. However, there is a workaround from one of SciChart users. You should override the AttachAnnotation(..) method in CompositeAnnotation class in this way:

protected virtual void AttachAnnotation(IAnnotation item)

{
item.Services = Services;
item.ParentSurface = ParentSurface;
item.IsAttached = true;

item.OnAttached();

// Optional bindings here
var annotation = item as AnnotationBase;
if (annotation != null)
{
    var xAxisIdbinding = new Binding
    {
        Source = this,
        Path = new PropertyPath(XAxisIdProperty)
    };
    annotation.SetBinding(XAxisIdProperty, xAxisIdbinding);

    var yAxisIdbinding = new Binding
    {
        Source = this,
        Path = new PropertyPath(YAxisIdProperty)
    };
    annotation.SetBinding(YAxisIdProperty, yAxisIdbinding);

    var isHiddenBinding = new Binding
    {
        Source = this,
        Path = new PropertyPath(IsHiddenProperty)
    };
    annotation.SetBinding(IsHiddenProperty, isHiddenBinding);
}

}

Besides, you have to set both properties IsEditable and CanSditText to “True”.

Please try this and let me know if everything works as expected.

Best Regards,
Yuriy

  • You must to post comments
Showing 1 result
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