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.
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.