Pre loader

How to specify TooltipModifier.TooltipTemplate


I am doing SciChart development with MVVM.
I generate RenderableSeries with ViewModel, View uses Bind it and uses it.

TooltipModifier is used for tooltip display.
In this application, I want to customize and display the tooltip.

To customize using the TooltipTemplate of TooltipModifier,
It was described in the following URL.
In this method, TooltipModifier.TooltipTemplate is described in XAML in View resource.
Therefore, it is not possible to specify TooltipModifier.TooltipTemplate from ViewModel.

If you generate RenderableSeries with ViewModel,
How should I specify the TooltipTemplate?

  • You must to post comments

When I try this I get the following exception

  • You must to post comments

In the SciChart WPF Documentation there is a page for how to bind tooltip templates in MVVM

A lot of customers ask us how to style various attached properties used in SciChart in the MVVM API. For example, the given following attached properties, how do we convert this to the MVVM API?

          <Style TargetType="s:FastLineRenderableSeries" x:Key="PropertyStyles">
              <Setter Property="s:TooltipModifier.TooltipTemplate" Value="{StaticResource TooltipTemplate}"/>
              <Setter Property="s:TooltipModifier.IncludeSeries" Value="True"/>
              <Setter Property="s:SeriesValueModifier.IncludeSeries" Value="False"/>
      <s:SciChartSurface s:RenderableSeries="{Binding Series}">            

The solution is simple, to use our method of Styling the RenderableSeries presented in Worked Example – Style a Series in MVVM.

Simply declare the attached properties and tooltip templates in a style in your View.

public class MainViewModel : BindableObject
          public MainViewModel()
              Series = new ObservableCollection<IRenderableSeriesViewModel>();
              Series.Add(new LineRenderableSeriesViewModel()
                  Stroke = Colors.Red,
                  DataSeries = ... // todo 
                  StyleKey = "PropertyStyles"
          public ObservableCollection<IRenderableSeriesViewModel> Series { get; private set; }

Best regards,

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies