Click here to Skip to main content
15,071,399 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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 :
XML
<StopStoryboard BeginStoryboardName="SBTouchDown"/>

in this code i used visual state group :
XML
 <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 :
XML
 <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
Posted
Updated 23-Jul-16 1:57am
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900