1

I would like to add a tooltip over the datapoint of a lineseries that shows both the X and Y values (independent and dependent values), rather than just the dependent value that appears by default. I am aware this is the same question as was written in this ticket - WPF toolkit charting : Customize datapoint label

However, I can't get the answer to work. There is a link to more detail that appears to be outdated.

My line series:

<DVC:Chart.Series>   

<!--Have several lineseries that look like this, connected to a styling vm. Can add ToolTip=...-->

<VM:LineSeries x:Name="something"
            Title="something"  
            DependentValuePath="Value" 
            IndependentValuePath="Key"
            ItemsSource="{Binding something}"
            DataPointStyle="{StaticResource DataPointBlue}"
           >
        </VM:LineSeries>

</DVC:Chart.Series>

My datapoints are styled here, but adding a setter property with any tooltip doesn't make a difference:

<UserControl.Resources>
    <Style x:Key="DataPointBlue" TargetType="{x:Type DVC:DataPoint}">
        <Setter Property="Background" Value="Blue"/>
    </Style>
</UserControl.Resources>

I've tried adding this line of code from the above linked ticket in several places in a variety of ways, and I've tried using Binding in various ways, but nothing has hit the mark.

<ToolTipService.ToolTip>
            <StackPanel Margin="2,2,2,2">
                <ContentControl Content="{TemplateBinding IndependentValue}" />
                <ContentControl Content="{TemplateBinding DependentValue}" />
            </StackPanel>
</ToolTipService.ToolTip>

This has been a lot of trial and error that hasn't been making progress.

voluntier
  • 330
  • 4
  • 11

0 Answers0