How can I hookup a custom tooltip (like the FinancialPriceSeries tooltip in the sample ChartTooltips.xaml) for a dynamically or programmatically created scatter series? I tried the following but it errors out:
Dim xmMessageSeries As New ScatterSeries()xmMessageSeries.XMemberPath = "XxmMessageSeries.YMemberPath = "Y"xmMessageSeries.ItemsSource = MyDataDim objTooltip As New ToolTipobjTooltip.ContentTemplate = CType(FindResource("MyToolTipTemplate"), DataTemplate)xmMessageSeries.ToolTip = objTooltip
I made my custom tooltip in xaml as a DataTemplate, but it errors when I hover over it with the error "ToolTip cannot have a logical or visual parent".
Any suggestions on the right way to do this?
In case anyone wants to know what my tooltip DataTemplate looks like here it is:
<DataTemplate x:Key="MyToolTipTemplate">
<StackPanel Orientation="Vertical">
<TextBlock Text="My Tool Tip" FontWeight="Bold"/>
</StackPanel>
</DataTemplate>
Hello,
I have been looking into your requirement and can suggest you look through this link from our online documentation that describes how you can create a ToolTip of your own: http://help.infragistics.com/NetAdvantage/WPFDV/2011.1/CLR4.0/?page=xamDataChart_Chart_Tooltips.html . And in your case you can set the series ToolTip property like so:
<ig:LineSeries ValueMemberPath="Value"
ItemsSource="{Binding}"
XAxis="{Binding ElementName=xmXAxis}"
YAxis="{Binding ElementName=xmYAxis}">
<ig:LineSeries.ToolTip>
</ig:LineSeries.ToolTip>
</ig:LineSeries>
Please let me know if I can assist you further on the matter.
The above tact did work - so the answer is to set up an empty series in xaml so that you can prepare the tooltip in xaml as well. Then fill the scatter series in code.
Petar,
Thank you for your response and suggestion. Unfortunately, the link that you pointed me to was the exact code I used (I copied and pasted the style from that documentation into my project).
I am currently trying another approach to the same thing by setting an empty Scatter Series in xaml so I can create the ToolTip in the xaml of the emty series without having to use the DataTemplate. I'll then grab the Scatter Series from the code-behind to fill it with the data points dynamically. I'll let you know if that works...
TJ