SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

0
0

This question is more about WPF, but I can’t find any information how to do it.
I need to compute some information and write it in TextBlock.

Ideally If I could wrap OhlcSeriesInfo into my wrapper class. Then set this wrapper as DataContext and binding to its properties.
I rised this question on stack overflow:
https://stackoverflow.com/questions/48916897/how-to-make-wrapper-for-datatype-datacontext-in-wpf
but still no one helped me.
I don’t know why this is so hard question. Hope here I’ll find answer.

Version
5.1.0.11243
  • You must to post comments
0
0

Hi Denis,

Your question on stack overflow is quite vague, I’m not surprised it doesn’t have any answers. Even I don’t know what you mean!

But your question here makes a little more sense. What you want to do is have a custom class as datacontext for the TooltipModifier in SciChart.

That we can do.

See the TooltipModifier Documentation.

Changing the Tooltip DataContext
The TooltipModifier features the ability to easily change the DataContext (or viewmodel) for Tooltips, via the
TooltipModifier.TooltipLabelDataContextSelector property.

In the Examples > 2D Charts > Tooltips and Hit Test > Using TooltipModifier Tooltips example the
TooltipModifier.TooltipLabelDataContextSelector property is bound to a ViewModel property
allowing you to wrap extra info around the SeriesInfo provided by SciChart.
This lets you inject extra information into the tooltips easily.

Let me know if that helps,

Best regards,
Andrew

  • You must to post comments
0
0

Thank you. I tried to use TooltipLabelDataContextSelector and I have some misunderstandings.

1) As I understand I can combine CursorModifier and TooltipModifier. Do I do it right? I.e. should I CursorModifier.ShowTooltip set to False?

       <s:CursorModifier
           ShowTooltip="False" ShowAxisLabels="True" />

        <s:TooltipModifier
            ShowTooltipOn="Always" />

2) Does TooltipModifier.ShowAxisLabels not work? It has no effect.

3) Am I forced to write in custom tooltip class properties: Color Stroke and Brush Fill?
Now I’m getting error: BindingExpression path error: ‘Stroke/Fill’ property not found on ‘object’ ”TooltipInfo.

4) Why does CursorModifier not have such property? I could do with one CursorModifier.

5) I think this API looks not good. I’d prefer to do this only via WPF.
Maybe is there a way to convert OhlcSeriesInfo (DataContext) to my custom (wrapper) class?
If I could pass current DataContext to ObjectDataProvider’s constructor then I could convert via only XAML.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.