FrameworkElement.Triggers Property
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Gets the collection of triggers for animations that are defined for a FrameworkElement.
Namespace: System.Windows
Assembly: System.Windows (in System.Windows.dll)
Syntax
'Declaration
Public ReadOnly Property Triggers As TriggerCollection
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.
Remarks
EventTrigger and the object.Triggers property element usage on elements are supported by Silverlight, 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.
Version Information
Silverlight
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
See Also