I am adding annotations to a chart that is bound to MVVM data and has multiple Y axes. The annotation data all applies to a single series/axis. I have seen that the IsHidden property can be used to toggle the visibility of an annotation. Is there a way to have the annotations tied to the visibility of a series/axis? So if the series is hidden by unchecking its box in the legend, can the associated annotations all be hidden also?
I realize that I can iterate my annotation collection and toggle the property when the series visibility changes, but it would be nice if there were a way for that to happen automatically.
There’s no easy way to do this other than ‘Foreach annotation in Annotations where YAxisId = …’.
I was going to suggest a default style, but since AnnotationBase.YAxis is not a dependency property you can’t bind AnnotationBase.IsHidden directly to YAxis.Visibility.
Maybe you could do it with an element name binding from AnnotationBase.IsHidden to YAxis.Visibility but it wouldn’t be clean or easy. I think stick with what you have!
Please login first to submit.