FrameworkElement.Triggers Property

July 28, 2014

Gets the collection of triggers for animations that are defined for a FrameworkElement.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

public TriggerCollection Triggers { get; }
<frameworkElement>
  <frameworkElement.Triggers>
    oneorMoreTriggers
  </frameworkElement.Triggers>
</frameworkElement>

XAML Values

oneorMoreTriggers

One or more object elements of type EventTrigger.

Property Value

Type: System.Windows.TriggerCollection
The collection of triggers for animations that are defined for this object.

EventTrigger and the object.Triggers property element usage on elements are supported by Windows Phone, but using this technique is discouraged for current applications. EventTrigger can only support a triggering action for the Loaded event (you name the triggering event in the EventTrigger.RoutedEvent property.) This makes the EventTrigger technique unsuitable for most run-time interactions. Instead of using EventTrigger and the Triggers property, consider one of the following two alternatives:

  • For animating properties on objects that are not controls, place the storyboard in the general Resources for a page or application. Then assign an event handler on the element where you would have placed "Triggers". The event handler, when responding to the relevant event, should retrieve the storyboard from the resource dictionary. You then call Begin on the retrieved Storyboard. An additional benefit of this technique is that the same storyboard can be applied to multiple user interactions.

  • For animating properties on objects that are controls (derive from Control), use the VisualStateManager technique, and run the appropriate animations based on state of or inputs to the control by calling GoToState.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft