BeginStoryboard BeginStoryboard BeginStoryboard BeginStoryboard Class

Definition

A trigger action that begins a Storyboard. Not commonly used. See Remarks.

public : sealed class BeginStoryboard : TriggerAction, IBeginStoryboard
public sealed class BeginStoryboard : TriggerAction, IBeginStoryboard
Public NotInheritable Class BeginStoryboard Inherits TriggerAction Implements IBeginStoryboard
var beginStoryboard = new beginStoryboard();
<BeginStoryboard ...>
  singleStoryboard
</BeginStoryboard>
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Examples

This XAML example shows the basic structure for using FrameworkElement.Triggers with its default FrameworkElement.Loaded trigger behavior to run a storyboarded animation. This XAML shows the EventTrigger and BeginStoryboard container elements in proper relationship with each using their XAML content property syntax and unnecessary property element tags (such as BeginStoryboard.Storyboard ) omitted.

<Canvas Width="200" Height="200" x:Name="animatedcanvas" Background="Red">
    <Canvas.Triggers>
        <EventTrigger>
            <BeginStoryboard>
                <Storyboard x:Name="ColorStoryboard">
                   <!-- Animate the background of the canvas to green over 4 seconds. -->
                    <ColorAnimation Storyboard.TargetName="animatedcanvas"
                      Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                      To="Green" Duration="0:0:4"/>
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Canvas.Triggers>
</Canvas>

Remarks

Triggers, EventTrigger, Actions and BeginStoryboard are not commonly used. These API mainly exist for compatibility in XAML originally used for Microsoft Silverlight. For most scenarios where event triggers were used previously, you should either use visual states, or start animations by writing a Loaded handler that looks up an animation in page-level resources and then calls Begin on the animation's main Storyboard. For more info, see Quickstart: Control templates or Storyboarded animations.

If you do choose to use Triggers, in Windows Runtime XAML, the default behavior for event triggers and the only event that can be used to invoke an EventTrigger is FrameworkElement.Loaded. Because that's both the default and the only enabled behavior, you don't set RoutedEvent, and just use the XAML <EventTrigger>. For more info, see Triggers.

Constructors

BeginStoryboard() BeginStoryboard() BeginStoryboard() BeginStoryboard()

Initializes a new instance of the BeginStoryboard class.

public : BeginStoryboard()
public BeginStoryboard()
Public Sub New()
var beginStoryboard = new beginStoryboard();

Properties

Storyboard Storyboard Storyboard Storyboard

Gets or sets the Storyboard that this BeginStoryboard starts.

public : Storyboard Storyboard { get; set; }
public Storyboard Storyboard { get; set; }
Public ReadWrite Property Storyboard As Storyboard
var storyboard = beginStoryboard.storyboard;
beginStoryboard.storyboard = storyboard;
<BeginStoryboard>
  <Storyboard ...>
    oneOrMoreAnimations
  </Storyboard>
</BeginStoryboard>
Value
Storyboard Storyboard Storyboard Storyboard

The Storyboard that the BeginStoryboard starts. The default is null.

Examples

This XAML example shows the basic structure for using FrameworkElement.Triggers with its default FrameworkElement.Loaded trigger behavior to run a storyboarded animation. This XAML shows the EventTrigger and BeginStoryboard container elements in proper relationship with each using their XAML content property syntax and unnecessary property element tags (such as BeginStoryboard.Storyboard ) omitted.

<Canvas Width="200" Height="200" x:Name="animatedcanvas" Background="Red">
    <Canvas.Triggers>
        <EventTrigger>
            <BeginStoryboard>
                <Storyboard x:Name="ColorStoryboard">
                   <!-- Animate the background of the canvas to green over 4 seconds. -->
                    <ColorAnimation Storyboard.TargetName="animatedcanvas"
                      Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                      To="Green" Duration="0:0:4" />
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Canvas.Triggers>
</Canvas>

Remarks

Triggers, EventTrigger, and BeginStoryboard are not commonly used. These API mainly exist for compatibility in XAML originally used for Microsoft Silverlight. For most scenarios where event triggers were used previously, you should either use visual states, or start animations by writing a Loaded handler that looks up an animation in page-level resources and then calls Begin on the animation's main Storyboard. For more info, see Quickstart: Control templates or Storyboarded animations.

See Also

StoryboardProperty StoryboardProperty StoryboardProperty StoryboardProperty

Identifies the BeginStoryboard.Storyboard dependency property.

public : static DependencyProperty StoryboardProperty { get; }
public static DependencyProperty StoryboardProperty { get; }
Public Static ReadOnly Property StoryboardProperty As DependencyProperty
var dependencyProperty = Windows.UI.Xaml.Media.Animation.BeginStoryboard.storyboardProperty;

Dispatcher Dispatcher Dispatcher Dispatcher

Inherited from DependencyObject

Methods

ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty)

Inherited from DependencyObject

GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty)

Inherited from DependencyObject

GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty)

Inherited from DependencyObject

ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty)

Inherited from DependencyObject

RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)

Inherited from DependencyObject

SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object)

Inherited from DependencyObject

UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64)

Inherited from DependencyObject

See Also