01/17/2011 08:00 (SOLUTION)
===========================================================================
ATTENTION! Please do not delete this as I am testing Codeproject site
functionality regarding posting solutions to your own questions. Many
thanks.
===========================================================================
Well, I haven't been able to find anything that will let me do it that way, so I added a property to the
DataPointSeries
items called
ParentChartSeries
, and after the series is created, I call a method in my page that sets this property, like so:
foreach (DBSeriesDataItem item in series.ItemsSource)
{
item.ParentChartSeries = series;
}
After that, I could do this in the XAML:
<ContentControl Content="{Binding ParentChartSeries, Converter={StaticResource TooltipTitleConverter}}" />
Here's the TooltipTitleConverter defined in the XAML:
<local:BudgetPanelBase.Resources>
<local:TooltipTitleConverter x:Key="TooltipTitleConverter" />
</local:BudgetPanelBase.Resources>
And finally, the code for the converter:
public class TooltipTitleConverter : IValueConverter
{
public object Convert(Object value, System.Type targetType, Object parameter, System.Globalization.CultureInfo culture)
{
Label label = null;
if (value != null)
{
MSChart.DataPointSeries series = value as MSChart.DataPointSeries;
label = new Label();
label.Content = series.Title;
}
return obj;
}
public object ConvertBack(Object value, System.Type targetType, Object parameter, System.Globalization.CultureInfo culture)
{
return value;
}