Pre loader

Rollover legend in a TabControl

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

0
0

I am currently evaluating the use of SciChart for an application we are developing that requires real-time data graphing. The application uses a TabControl, with different usercontrols in each TabItem .

So I am attempting to replicate the RealTimeCursor example inside a tabItem of a Tabcontrol. The problem I am having is with the rollover legend. Basically the rollover legend appears only if the control is in the first TabItem but not if in the second or subsequent tabItem. Everything else appears to work correctly.

The problem is that the legend does not appear in the “graph” tab – unless the graph tab is the first tab, i.e. – legend appears in the Graph tab as it the first tab (“Test” is the second (empty) tab).

    <TabControl>
        <TabItem Header="Graph">
            <local:RealTimeCursors   x:Name="RealTimeChart"/>
        </TabItem>
        <TabItem Header="Test"></TabItem>
    </TabControl>

but legend does not appear if “Graph” tab is the second tab (now “Test” is the first tab) i.e.

    <TabControl>
        <TabItem Header="Test"></TabItem>
        <TabItem Header="Graph">
            <local:RealTimeCursors   x:Name="RealTimeChart"/>
        </TabItem>
    </TabControl>

As I want to include one graph inside a tabcontrol – and it is not the first tab – the legend is not appearing. I do not know how to fix this. Can you give me some pointers on how I should modify the RealTimeCursors example to work inside a tabcontrol? Thanks!

Attachments
  • You must to post comments
0
0

Hi Steve,

Thanks for the sample. I tried it again, and got the following message in the Output window:

System.Windows.Data Error: 4 : Cannot find source for binding with reference ‘ElementName=rolloverModifier’. BindingExpression:(no path); DataItem=null; target element is ‘ItemsControl’ (Name=”); target property is ‘DataContext’ (type ‘Object’)

I’m not sure why this happens, but there is an easy workaround: the code does work if you put the RolloverModifier into Resources section as a static resource:

<UserControl.Resources>

    <s:RolloverModifier x:Key="rolloverModifier" ShowAxisLabels="False" UseInterpolation="True" />
</UserControl.Resources>

<s:SciChartSurface x:Name="sciChartSurface" ChartModifier="{StaticResource rolloverModifier}" …/>

<ItemsControl DataContext="{StaticResource rolloverModifier}">

Hope this helps!

Best regards,
Yuriy

  • steve71
    Many thanks for your quick reply Yuriy. Yes I got the same error. I'll give your solution a try Cheers Steve
  • steve71
    Yes, now working, thanks again :-D
  • You must to post comments
Showing 1 result
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