Pre loader

Changing an annotation's Z-Index

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


I’m using a chart as a way to visualise a series of time-based tasks on a “timeline”, not unlike a Gantt chart (is there anything SciChart can’t be used for?!). I do this using annotations that the user can move and resize, actually custom “box” annotations that can only be dragged and resized horizontally. Image attached if interested.

When a user starts moving or resizing an annotation, I bring it to the front to ensure that it remains visible even if it ends up overlapping another annotation, using:

Panel.SetZIndex(annotation, Int.MaxValue);
For every other annotation
    Panel.SetZIndex(annotation, 0);

Finding this approach was a bit of a happy accident so I’m wary of continuing to use this technique in case it breaks in a future version. I’m assuming this code works because annotations reside in a parent container that inherits from Panel? Do you see any issues using the above or is there a “better” way to change an annotation’s Z-Index?

  • You must to post comments

Hello Andrew,

Thanks for your question.

Your approach is perfectly valid. Our Annotations are WPF UI elements placed on a Canvas, so this is the right way of doing that.

Best Regards,

  • You must to post comments

Hi there

The z-Index of annotations in SciChart WPF is also the order they are in the SciChartSurface.Annotations collection.

Just re-order the annotations and the z-order will change.

Hope this helps

Best regards

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.