[WPF] How to Stop an Animation
-
It appears that the
Storyboard
won't accept a newRepeatBehavior
structure once the animation has already begun. I want to have an animation repeat endlessly, until the user clicks the window. I have the animationRepeatBehavior
set toForever
in the XAML. How do I stop the animation once it's begun?The difficult we do right away... ...the impossible takes slightly longer.
-
It appears that the
Storyboard
won't accept a newRepeatBehavior
structure once the animation has already begun. I want to have an animation repeat endlessly, until the user clicks the window. I have the animationRepeatBehavior
set toForever
in the XAML. How do I stop the animation once it's begun?The difficult we do right away... ...the impossible takes slightly longer.
Change the
RepeatBehavior
and callStop()
Venkatesh Mookkan (My Recent Article: WPF Custom Control - FilterControl for ListBox/ListView)
-
Change the
RepeatBehavior
and callStop()
Venkatesh Mookkan (My Recent Article: WPF Custom Control - FilterControl for ListBox/ListView)
Thanks.
The difficult we do right away... ...the impossible takes slightly longer.
-
It appears that the
Storyboard
won't accept a newRepeatBehavior
structure once the animation has already begun. I want to have an animation repeat endlessly, until the user clicks the window. I have the animationRepeatBehavior
set toForever
in the XAML. How do I stop the animation once it's begun?The difficult we do right away... ...the impossible takes slightly longer.
-
It appears that the
Storyboard
won't accept a newRepeatBehavior
structure once the animation has already begun. I want to have an animation repeat endlessly, until the user clicks the window. I have the animationRepeatBehavior
set toForever
in the XAML. How do I stop the animation once it's begun?The difficult we do right away... ...the impossible takes slightly longer.
Another alternative maybe...all in XAML...
<Grid Name="theGrid" Background="SteelBlue" > <Grid.Triggers> <EventTrigger RoutedEvent="Grid.Loaded"> <BeginStoryboard x:Name="gridBeginStoryboard" > <Storyboard> <DoubleAnimation Storyboard.TargetName="theGrid" Storyboard.TargetProperty="Opacity" From="1.0" To="0.0" Duration="0:0:2" AutoReverse="True" RepeatBehavior="Forever" /> </Storyboard> </BeginStoryboard> </EventTrigger> <EventTrigger SourceName="theGrid" RoutedEvent="Grid.MouseLeftButtonDown"> <StopStoryboard BeginStoryboardName="gridBeginStoryboard" /> </EventTrigger> </Grid.Triggers> </Grid>
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
It appears that the
Storyboard
won't accept a newRepeatBehavior
structure once the animation has already begun. I want to have an animation repeat endlessly, until the user clicks the window. I have the animationRepeatBehavior
set toForever
in the XAML. How do I stop the animation once it's begun?The difficult we do right away... ...the impossible takes slightly longer.
u can create a doubleanimation type, and then set douleanimation type equals(storyboard)Findresource("name of storyboard"); and doubleanimation.stop()..