I have created a stacked bar chart with 2 series and animated the series using codebehind. I would like to add triggers so that my datapoints will change color on mouseover. However, if I add a style as in <windows.resource>:
<Style TargetType="{x:Type igCA:DataPoint}"> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Fill" Value="Red" /> </Trigger> </Style.Triggers></Style>
Style
TargetType
=
"{x:Type igCA:DataPoint}"
>
<
Style.Triggers
Trigger
Property
"IsMouseOver"
Value
"True"
Setter
"Fill"
"Red"
/>
</
What ends up happening is that the animation "restarts" or begins again everytime I mouseover a datapoint.
What can I do so that the series animation runs once and stops so that the mouseover trigger can change the datapoint colors? The triggers for the datapoint colors work fine when I do not enable the series animation. I have a sample xaml page with series animations and triggers set, and it is still doing the same thing. I know this is possible, so if someone can point me in the right direction I would much appreciate it!
unfortunately, changing the Fill property causes the chart to repaint, thus restarting the animation. you can use a hack like this to set the Series.Animation to null after it has a chance to run:
private void theChart_Loaded(object sender, RoutedEventArgs e) { DispatcherTimer animationCompleteTimer = new DispatcherTimer(); animationCompleteTimer.Interval = this.theChart.Series[0].Animation.Duration.TimeSpan; animationCompleteTimer.Tick += new EventHandler(animationCompleteTimer_Tick); animationCompleteTimer.Start(); } private void animationCompleteTimer_Tick(object sender, EventArgs e) {
this.theChart.Series[0].Animation = null; ((DispatcherTimer)sender).Stop();
}
Thanks!