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!
- steve71 asked 10 years ago
- You must login to post comments
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
- Yuriy Zadereckiy answered 10 years ago
-
Many thanks for your quick reply Yuriy. Yes I got the same error. I'll give your solution a try Cheers Steve
-
Yes, now working, thanks again :-D
- You must login to post comments
Please login first to submit.