A trigger action that removes a Storyboard.
Assembly: PresentationFramework (in PresentationFramework.dll)
Gets a value that indicates whether this instance is currently sealed (read-only).(Inherited from DependencyObject.)
Re-evaluates the effective value for the specified dependency property(Inherited from DependencyObject.)
Returns the local value of a dependency property, if it exists. (Inherited from DependencyObject.)
Sets the value of a dependency property without changing its value source. (Inherited from DependencyObject.)
Sets the local value of a dependency property, specified by its dependency property identifier. (Inherited from DependencyObject.)
Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.(Inherited from DependencyObject.)
Returns a string that represents the current object.(Inherited from Object.)
To be able to pause, resume, remove, or otherwise control a Storyboard interactively, set the Name property of its BeginStoryboard and use a ControllableStoryboardAction object (such as PauseStoryboard, ResumeStoryboard, or StopStoryboard) to control it by referencing its Name. If the Name of BeginStoryboard is unspecified, the Storyboard cannot be interactively controlled after it is begun. See How to: Use Event Triggers to Control a Storyboard After It Starts for more information.
You should use the HandoffBehavior of Compose. It's also a good idea to remove background animations when the object they animate is no longer being used. For example, if you apply an indefinitely repeating storyboard using an element's Loaded event, you should also create an EventTrigger that uses a action to remove the storyboard on the element's Unloaded event.action to remove any storyboards begun with a
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="RootPage"> <StackPanel> <!-- The MediaElement control plays the sound. --> <MediaElement Name="myMediaElement" /> <Button Name="BeginButton">Begin</Button> <StackPanel.Triggers> <!-- This trigger causes the Storyboard to start (the music start) when you click the "BeginButton" button. --> <EventTrigger RoutedEvent="Button.Click" SourceName="BeginButton"> <EventTrigger.Actions> <BeginStoryboard Name="myBeginStoryboard"> <Storyboard> <MediaTimeline Source="C:\WINDOWS\Media\town.mid" Storyboard.TargetName="myMediaElement" RepeatBehavior="Forever" /> </Storyboard> </BeginStoryboard> </EventTrigger.Actions> </EventTrigger> <!-- When this page unloads, like when you navigate away from the page, this trigger causes the Storyboard to be removed and the clock to stop. If you come back to this page and click the button to start the Storyboard, the music starts from the beginning. Alternatively, if you don't unload the Storyboard when you leave the page, the Storyboard does not stop while you're gone and when you navigate back to the page you hear the music continuing as though you had never left. --> <EventTrigger RoutedEvent="Page.Unloaded" > <EventTrigger.Actions> <RemoveStoryboard BeginStoryboardName="myBeginStoryboard" /> </EventTrigger.Actions> </EventTrigger> </StackPanel.Triggers> </StackPanel> </Page>
Available since 3.0
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.