I am currently using a xamChart and I would like to display a tooltip and at the same time, change the background color when the mouseOver is true. I went through the Infragistics help and used the code snippet, but when ToolTip and IsMouseOver are both set, the tooltip does not show up. If the Style.Triggers is removed, the tooltip is shown. Here is a snippet from my XAML code:
< Style
Value ="Red" />Property ="Fill"< SetterTargetType="{x:Type igCA:DataPoint }">x:Key ="dataPointStyle"
< Setter
Property ="ToolTip"
Value ="Hello" />
<Style.Triggers >
< Trigger
Property ="IsMouseOver"
Value ="True">
Property ="Fill"
Value ="Azure" />
</Trigger >
</Style.Triggers >
</Style >
Is there a way to do both?
Thanks.
Hello,
One way to achieve this is using a custom DataTemplate for the ColumnChartTemplate. You can get the style from the DefaultStyles\Chart\XamChartDefault.xaml file and modify it. For example you can see my sample project where i'm setting the following template :
<DataTemplate DataType="{x:Type igCA:ColumnChartTemplate}"> <DataTemplate.Resources> <Storyboard x:Key="MoveOverLighten"> <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border" Storyboard.TargetProperty="(Panel.Background).Color"> <SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="Red"/> </ColorAnimationUsingKeyFrames> </Storyboard> </DataTemplate.Resources>
<Grid x:Name="LegendControl" ToolTip="{Binding Path=ToolTip}" > <Border HorizontalAlignment="Stretch" Width="Auto" Background="{Binding Path=Fill}" BorderBrush="{x:Null}" BorderThickness="0,0,0,0" CornerRadius="3,3,0,0" x:Name="border"/> </Grid>
<DataTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Trigger.EnterActions> <BeginStoryboard Storyboard="{StaticResource MoveOverLighten}" x:Name="MoveOverLighten_BeginStoryboard"/> </Trigger.EnterActions> <Trigger.ExitActions> <StopStoryboard BeginStoryboardName="MoveOverLighten_BeginStoryboard"/> </Trigger.ExitActions> </Trigger> </DataTemplate.Triggers></DataTemplate>
Hope this helps
Vlad