Hi folks,
In the old days, text annotations were implemented using a CustomAnnotationsChartModifier which would bind to a collection of TextAnnotationViewModels. The TextAnnotationViewModel included tool tip text in addition to the main text and the coordinates.
In the current SciChart, eventualy we now bind a collection of IAnnotationViewModels to the SciChartSurface’s built-in Annotations property. But these viewmodels do not implement a member for tool tip text.
How can I replicate my old code, which dynamically created and displayed text annotations which implement a ToolTip as well?
- yefchak asked 6 months ago
Hi George, Thank you for contacting us. I’m forwarding your inquiry to our team for further discussion. We’ll get back to you as soon as we have an update. Kind regards, Lex S., MSEE SciChart Technical Support Engineer
- You must login to post comments
Hi George,
I hope this message finds you well.
We reviewed your inquiry.
As far as Annotation in SciChart are WPF UI elements, you can set the WPF Tooltip for them directly.
However, for MVVM application, the approach differs a bit, and we recommend adding a Tooltip for the TextAnnotationViewModel as follows:
Please create a Style for the TextAnnotation and set the Tooltip property there.
This Style then can be applied to the TextAnnotationViewModel using the StyleKey property.
Please see the following Worked Example article for more information regarding Styling Annotations in MVVM:
SciChart WPF Documentation – Worked Example – Styling Annotations in MVVM _ WPF Chart Documentation
Kind regards,
Lex S., MSEE
SciChart Technical Support Engineer
- Lex answered 5 months ago
- last edited 5 months ago
- You must login to post comments
Hi,
Thanks for this. But I’m afraid I’m not seeing exactly what I need. I have a viewmodel for my annotation as follows:
public PeakLabelViewModel(double x, double y, string text, string tooltip)
{
X1 = x;
Y1 = y;
FontSize = 14;
Text = text;
HorizontalAnchorPoint = SciChart.Charting.Visuals.Annotations.HorizontalAnchorPoint.Center;
VerticalAnchorPoint = SciChart.Charting.Visuals.Annotations.VerticalAnchorPoint.Bottom;
Tooltip = tooltip;
StyleKey = “PeakLabelStyle”;
}
Note that I have set the Tooltip text, and it appears as desired. Note also that when I specify a StyleKey (PeakLabelStyle, which I have defined in XAML), this is applied to the text annotation. That’s great, but how can I apply another StyleKey to the tooltip itself?
Thanks,
–George
- yefchak answered 5 months ago
Hi George, Thank you for the update. I’m sorry for the delayed reply. We discussed your inquiry and logged a task to further investigate the mentioned feature. We’ll get back to you as soon as we have an update. Kind regards, Lex
- You must login to post comments
Hello George,
It is possible to declare Styles within other Styles using the Resources section. This approach allows you to define, for example, a Tooltip style inside a Style applied to an AnnotationViewModel via the StyleKey property.
By organizing styles this way, you can reference the inner Tooltip style directly from the ToolTip property within the same parent Style, like this:
<!-- Style for TextAnnotations -->
<Style x:Key="TextAnnotationStyle" TargetType="s:TextAnnotation">
<Style.Resources>
<!-- Style for Annotation Tooltips -->
<Style x:Key="TooltipStyle" TargetType="{x:Type ToolTip}">
.....
</Style>
</Style.Resources>
<!-- Tooltip with a Style applied-->
<Setter Property="ToolTip">
<Setter.Value>
<ToolTip Style="{StaticResource TooltipStyle}">
....
</ToolTip>
</Setter.Value>
</Setter>
</Style>
Please find the attached example demonstrating how to set up a TextAnnotation that displays a styled tooltip bound to an AnnotationViewModel.
Let us know if you have any questions or need further clarification – we’ll be happy to assist.
Best Regards,
Joeri
- Joeri R answered 3 months ago
- You must login to post comments
Please login first to submit.

