views:

703

answers:

1

Hi,,

I have created a custoom tooltip for a lineseries chart. however my problem is that this custom tooltip is never loaded..(I still get the default tooltip i.e. X-value)

Is there something I should be doing differently??

page.xaml

<Style x:Key="ttip" TargetType="chartingToolkit:LineDataPoint">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="chartingToolkit:LineDataPoint">
                    <Grid x:Name="Root" Opacity="0">
                        <ToolTipService.ToolTip>
                            <StackPanel>
                                <ContentControl Content="{TemplateBinding FormattedIndependentValue}"/>
                                <StackPanel Orientation="Horizontal">
                                    <ContentControl Content="{TemplateBinding FormattedDependentValue}"/>
                                </StackPanel>
                            </StackPanel>
                        </ToolTipService.ToolTip>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>





<chartingToolkit:Chart x:Name="chart" Grid.Row="0">
        <chartingToolkit:LineSeries
            DataPointStyle="{StaticResource ttip}" />

page.xaml.cs (creating and binding)

...

             lineSeries = new LineSeries()
            {
                ItemsSource = storageInfo,
                DependentValueBinding = new Binding(dependentValueString),
                IndependentValueBinding = new Binding("CollectionDatek__BackingField"),
            };
        }

...

Thanks for your help...

Ron..

+1  A: 

In your example code, you've set the Opacity of the Grid in the template to 0. That means invisible - nothing to see! Either remove the attribute, set it to 1, or consider using some sort of Storyboard to fade it in properly.

David Anson's blog post on "4 simple color/ToolTip" changes should assist you. As your code looks similar, you may already have this reference, but it's a great, concise document for others that find this topic.

Jeff Wilcox