I have a Radio Button Style Include Storyboard for its UI.
is it necessary to stop Storyboard in a visual state (or Event trigger) manually after lifetime ? in this case after 1 second.
in my researches i found some articles about Storyboard : [Stop and dispose animations (animations will keep running even when you navigate away)]
i used this code for manually stop storyboard :
<StopStoryboard BeginStoryboardName="SBTouchDown"/>
in this code i used visual state group :
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled">
<Storyboard>
<ColorAnimation
toryboard.TargetName="CheckMark" Storyboard.TargetProperty="(Ellipse.Fill).
SolidColorBrush.Color)"
To="LightGray"
uration="0:0:1" />
<ColorAnimation
toryboard.TargetName="EllipseMain" Storyboard.TargetProperty="(Ellipse.Stroke).
SolidColorBrush.Color)"
To="LightGray"
uration="0:0:1" />
</Storyboard>
lt;/VisualState> </VisualStateGroup>
and in this code i used EventTrigger :
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard Name="SBTouchDown">
<Storyboard>
<ColorAnimation
o="{StaticResource OverBackgroundColor}" SpeedRatio="{StaticResource
nimationSpeedRatio}" Storyboard.TargetName="imag"
toryboard.TargetProperty="Fill.Color" AccelerationRatio="0.2"
ecelerationRatio="0.8"/>
<DoubleAnimation
toryboard.TargetProperty="RenderTransform.Angle" To="90" SpeedRatio="
StaticResource AnimationSpeedRatio}" ></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="MouseLeave">
<BeginStoryboard>
<Storyboard>
<ColorAnimation
o="{StaticResource NormalBackgroundColor}" SpeedRatio="{StaticResource
nimationSpeedRatio}" Storyboard.TargetName="imag"
toryboard.TargetProperty="Fill.Color" AccelerationRatio="0.2"
ecelerationRatio="0.8"/>
<DoubleAnimation
toryboard.TargetProperty="RenderTransform.Angle" To="0" SpeedRatio="
StaticResource AnimationSpeedRatio}" ></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
What I have tried:
i try to have best possible optimize Storyboard Animations