Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
175
How to make the ToolTip display multiple values.
posted

I'm binding my xamchart of type Area  to a list containing 3 values which are months,balance and interest.

I have set the Datamapping as Value=Balance and Label = Month.

I want the tooltip on the datapoint to show balance aswell as interest. I know i can set the ToolTip = Interest in Datamapping, but i also want to show the Balance. Is there anyway by which i can access the datasource from the tooltip's datatemplate and then display all the values.I tried some options like the one below but didnt work.

Please help.

Thanks. 

<!-- Chart Series -->

<igCA:XamChart.Series>

<igCA:Series ChartType="Area"

DataSource="{Binding Path=MonthlyAccountList}"

DataMapping="Value=Balance;Label=Month;ToolTip=Interest">

</igCA:Series>

</igCA:XamChart.Series>

<!-- ToolTip Style-->

<Style TargetType="ToolTip">

<Setter Property="FontSize" Value="15" />

<Setter Property="Template">

<Setter.Value>

<ControlTemplate TargetType="ToolTip">

<Border BorderBrush="Black"

BorderThickness="1"

Background="LightGray">

<Grid DataContext="{Binding  RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type igCA:Series}}}">

<Grid.ColumnDefinitions>

<ColumnDefinition/>

<ColumnDefinition/>

</Grid.ColumnDefinitions>

<Grid.RowDefinitions>

<RowDefinition/>

<RowDefinition/>

<RowDefinition/>

</Grid.RowDefinitions>

<TextBlock Style="{StaticResource TextBlockStyle}"

Grid.Row="0"

Grid.Column="0"

Text="Account Balance:"/>

<Label Style="{StaticResource DollarLabelStyle}"

Grid.Row="0"

Grid.Column="1"

Content="{Binding Balance}"/>

<TextBlock Style="{StaticResource TextBlockStyle}"

Grid.Row="1"

Grid.Column="0"

Text="Interest Amount:"/>

<Label Style="{StaticResource DollarLabelStyle}"

Grid.Row="1"

Grid.Column="1"

Content="{Binding Interest}"/>

</Grid>

</Border>

</ControlTemplate>

</Setter.Value>

</Setter>

</Style>