I am not sure if using multiple storyboards with FillBehavior=Stop
nor the layout is the best, but anyway to fix your code, you may need to cancel other storyboard.
Give names to storyboards and use StopStoryBoard
or (preferably) RemoveStoryBoard
:
<Trigger.EnterActions><BeginStoryboard x:Name="checked" ><Storyboard><DoubleAnimation Storyboard.TargetName="EllipseTranslateTransform" Storyboard.TargetProperty="X" To="10" Duration="0:0:0.2" /></Storyboard></BeginStoryboard><StopStoryboard BeginStoryboardName="unchecked" /></Trigger.EnterActions><Trigger.EnterActions><BeginStoryboard x:Name="unchecked"><Storyboard><DoubleAnimation Storyboard.TargetName="EllipseTranslateTransform" Storyboard.TargetProperty="X" From="10" Duration="0:0:0.2" /></Storyboard></BeginStoryboard><StopStoryboard BeginStoryboardName="checked" /></Trigger.EnterActions>
Also note, that default value TranslateTransform.X=0
, so you don't need to specify From
or To
when going from/to 0
(as you already did in first animation), rather only specify non-default value.
Edit: The value X=10
seems more approparite than 25
, edited in snippet.
I put the ToggleButton
into Viewbox
to observe smooth animation: