0

I have a few annotations in my graph, 3 to be exact. Two of them are text annotations, which I just need to stay visible, and that's what they're doing.

But I also have a LineArrowAnnotation, which I need to appear and disappear depending on the state of my underlying data model. I have bound the Visibility property bound to a bool property in the view model.

<sci:LineArrowAnnotation Visiblity="{Binding ArrowVisible, Converter={StaticResource BooleanToVisibilityConverter}}"

Pressing F12 on the "ArrowVisible" property in Xaml editor takes me to the appropriate place in the view model. I've verified in debugger that the value of my view model property is set according to my expectations and the getter for of the property is accessed when a change is triggered.

As you can in the screenshot, I can position the arrow by manipulating its X1,X2,Y1,Y2 coordinates (left and center). But if I try to set visibility in the same way, the tip of the arrow is still visible (right). I'm assuming the whole arrow is actually visible, but since the change that disables the arrow also sets all coordinates to 0, it's displayed at the edge of the graph and therefore only partially visible.

As a workaround, I've even tried to bind the stroke thickness of the annotation, setting it to 0 if the arrow is supposed to be hidden.

StrokeThickness="{Binding ArrowStrokeThickness}"

This too did not have any effect. However, it served to verify that the binding is correct and the value is read, because a breakpoint in the ArrowStrokeThickness getter was hit as expected. (I've added this property just for this workaround, so it can't have been accessed from anywhere else).

I realize I could work around it by placing the arrow outside of the visible range when it's not supposed to be visible, but that's an ugly solution that would require me to hack my view model.

I'd like to add that while I'm still using SciChart version 3.31, I've had the solution briefly updated to version 4.0.5 (I've since rolled back this change) and the arrow annotation was behaving the same.

Edit: deleted picture for intellectual property reasons.

Shaggydog
  • 3,456
  • 7
  • 33
  • 50

2 Answers2

0

So I found out that the LineArrowAnnotation inherits the Visibility property from UIElement. It seems that it wasn't supposed to actually support it. Either that, or the implementation is incorrect. Anyway, I looked at which properties actually belong to the LineArrowAnnotation class, and I managed to hide the arrowhead by binding the HeadLength property and setting it to 0 when the arrow is supposed to be hidden.

Shaggydog
  • 3,456
  • 7
  • 33
  • 50
0

This question has been asked many times on the SciChart Forums here, here, here and here.

The accepted solution is to bind to Annotation.IsHidden (boolean DependencyProperty) to show or hide an annotation.

Dr. Andrew Burnett-Thompson
  • 20,980
  • 8
  • 88
  • 178
  • 1
    Thanks. Originally I was gonna ask on SciChart forums, but you seemed to prefer answering questions here. Next time I'll search a bit more before asking. – Shaggydog Apr 25 '16 at 07:07