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?
- Ursu Luminita asked 2 years ago
- You must login to post comments
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
- Yuriy Zadereckiy answered 2 years ago
- You must login to post comments
Please login first to submit.