Windows Dev Center

EventTrigger.Actions property

Gets the collection of BeginStoryboard objects that this EventTrigger maintains.

Syntax


public TriggerActionCollection Actions { get; }


<EventTrigger>
  oneOrMoreBeginStoryboards
</EventTrigger>
 

XAML Values

oneOrMoreBeginStoryboards

One or more BeginStoryboard object elements. Object elements defined here become members of the list that is the value of the Actions property, if you use code to examine that collection at run time.

Property value

Type: TriggerActionCollection

The existing TriggerActionCollection.

Remarks

Triggers, EventTrigger, Actions and BeginStoryboard are not commonly used. These APIs mainly exist for compatibility in XAML originally used for Microsoft Silverlight. For most scenarios where event triggers were used previously, you should use built-in animations, 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.

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 EventTrigger.Actions) 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>

Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI.Xaml
Windows::UI::Xaml [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml
Windows::UI::Xaml [C++]

Metadata

Windows.winmd

See also

EventTrigger
XAML syntax guide

 

 

Show:
© 2015 Microsoft