Partager via


IXREventTrigger (Compact 2013)

3/28/2014

This class represents a trigger that applies a set of actions, also known as animation storyboards, in response to an event.

Syntax

class IXREventTrigger : public IXRTriggerBase

Inheritance Hierarchy

IXRDependencyObject

    IXRTriggerBase

        IXREventTrigger

Methods

Method

Description

IXREventTrigger::GetActions

Retrieves the collection of IXRBeginStoryboard objects that this object triggers.

IXREventTrigger::GetRoutedEvent

Retrieves the name of the event that initiates the trigger.

IXREventTrigger::SetRoutedEvent

Sets the name of the event that initiates the trigger.

Thread Safety

Members of this class are thread-safe if you previously called IXRApplication::CreateHostFromXaml and supplied it with an XRWindowCreateParams structure that has AllowsMultipleThreadAccess set to true.

Remarks

Although this class is available to you, we recommend that you instead add storyboard animations to the IXRResourceDictionary collection that belongs to an IXRFrameworkElement derived object. Use IXRFrameworkElement::GetResources to retrieve this collection of objects. Then, assign an event handler to the event that you want to trigger an animation storyboard. The event handler will respond to the relevant event by retrieving the storyboard from the resource collection and then calling IXRStoryboard::Begin.

Notice that the collection of triggers retrieved by IXRFrameworkElement::GetTriggers can only contain IXREventTriggers that support the Loaded event. You can also produce the same behavior by creating a handler for the Loaded event that calls the Begin method and then calling IXRFrameworkElement::AddLoadedEventHandler to attach its delegate to Loaded. However, using the event handler to start the storyboard is a more versatile coding pattern. You can also change or reuse the event handler to respond to a different event, such as MouseEnter.

When you create a class instance, use an IXREventTriggerPtr smart pointer instead of a raw interface pointer. For more information, see XRPtr<Interface>.

You can also define an event trigger in Microsoft Silverlight 3 XAML. For information about the differences between XAML in XAML for Windows Embedded and Silverlight 3, see Differences Between Microsoft Silverlight 3 and XAML for Windows Embedded. For more information about how to define this element in the source XAML for your application, see the EventTrigger Class on MSDN.

.NET Framework Equivalent

System.Windows.EventTrigger

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

Classes for Visual Appearance
IXRTriggerCollection