Hi,
I've got this problem where a DataTrigger stops working after a while. I've not been able to work out a pattern.
It basically moves a Rectangle around a Canvas, in directions N, NE, E, SE, S, SW, W, and NW.
Individually each animation works.
Certain COMBOs of movements fail.
'NNNN (repeated)' works.
'N, NE, E, SE, S, SW, W, NW' works. If I then try to move North again, it fails, as does every other direction except for NW which continues to work. NB: NW was the last successful animation prior to the 'bug'.
I'm starting to think that I can re-use a particular trigger multiple times, but that I can't 'return' to an old/used trigger once I use a different trigger.
Here's the Style.
Many thanks.
<Style x:Key="TestRectStyle" TargetType="{x:Type Rectangle}"><Style.Triggers><DataTrigger Binding="{Binding UI_DirectionOfMovement, Mode=OneWay}" Value="North"><DataTrigger.EnterActions><BeginStoryboard><Storyboard><DoubleAnimation Storyboard.TargetProperty="(Canvas.Top)" By="-50" Duration="0:0:0.8" AutoReverse="False" /><DoubleAnimation Storyboard.TargetProperty="(Canvas.Left)" By="0" Duration="0:0:0.8" AutoReverse="False" /></Storyboard></BeginStoryboard></DataTrigger.EnterActions></DataTrigger><DataTrigger Binding="{Binding UI_DirectionOfMovement, Mode=OneWay}" Value="NorthEast"><DataTrigger.EnterActions><BeginStoryboard><Storyboard><DoubleAnimation Storyboard.TargetProperty="(Canvas.Top)" By="-50" Duration="0:0:0.8" AutoReverse="False" /><DoubleAnimation Storyboard.TargetProperty="(Canvas.Left)" By="50" Duration="0:0:0.8" AutoReverse="False" /></Storyboard></BeginStoryboard></DataTrigger.EnterActions></DataTrigger><DataTrigger Binding="{Binding UI_DirectionOfMovement, Mode=OneWay}" Value="East"><DataTrigger.EnterActions><BeginStoryboard><Storyboard><DoubleAnimation Storyboard.TargetProperty="(Canvas.Top)" By="0" Duration="0:0:0.8" AutoReverse="False" /><DoubleAnimation Storyboard.TargetProperty="(Canvas.Left)" By="50" Duration="0:0:0.8" AutoReverse="False" /></Storyboard></BeginStoryboard></DataTrigger.EnterActions></DataTrigger><DataTrigger Binding="{Binding UI_DirectionOfMovement, Mode=OneWay}" Value="SouthEast"><DataTrigger.EnterActions><BeginStoryboard><Storyboard><DoubleAnimation Storyboard.TargetProperty="(Canvas.Top)" By="50" Duration="0:0:0.8" AutoReverse="False" /><DoubleAnimation Storyboard.TargetProperty="(Canvas.Left)" By="50" Duration="0:0:0.8" AutoReverse="False" /></Storyboard></BeginStoryboard></DataTrigger.EnterActions></DataTrigger><DataTrigger Binding="{Binding UI_DirectionOfMovement, Mode=OneWay}" Value="South"><DataTrigger.EnterActions><BeginStoryboard><Storyboard><DoubleAnimation Storyboard.TargetProperty="(Canvas.Top)" By="50" Duration="0:0:0.8" AutoReverse="False" /><DoubleAnimation Storyboard.TargetProperty="(Canvas.Left)" By="0" Duration="0:0:0.8" AutoReverse="False" /></Storyboard></BeginStoryboard></DataTrigger.EnterActions></DataTrigger><DataTrigger Binding="{Binding UI_DirectionOfMovement, Mode=OneWay}" Value="SouthWest"><DataTrigger.EnterActions><BeginStoryboard><Storyboard><DoubleAnimation Storyboard.TargetProperty="(Canvas.Top)" By="50" Duration="0:0:0.8" AutoReverse="False" /><DoubleAnimation Storyboard.TargetProperty="(Canvas.Left)" By="-50" Duration="0:0:0.8" AutoReverse="False" /></Storyboard></BeginStoryboard></DataTrigger.EnterActions></DataTrigger><DataTrigger Binding="{Binding UI_DirectionOfMovement, Mode=OneWay}" Value="West"><DataTrigger.EnterActions><BeginStoryboard><Storyboard><DoubleAnimation Storyboard.TargetProperty="(Canvas.Top)" By="0" Duration="0:0:0.8" AutoReverse="False" /><DoubleAnimation Storyboard.TargetProperty="(Canvas.Left)" By="-50" Duration="0:0:0.8" AutoReverse="False" /></Storyboard></BeginStoryboard></DataTrigger.EnterActions></DataTrigger><DataTrigger Binding="{Binding UI_DirectionOfMovement, Mode=OneWay}" Value="NorthWest"><DataTrigger.EnterActions><BeginStoryboard><Storyboard><DoubleAnimation Storyboard.TargetProperty="(Canvas.Top)" By="-50" Duration="0:0:0.8" AutoReverse="False" /><DoubleAnimation Storyboard.TargetProperty="(Canvas.Left)" By="-50" Duration="0:0:0.8" AutoReverse="False" /></Storyboard></BeginStoryboard></DataTrigger.EnterActions></DataTrigger></Style.Triggers></Style>