Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

FrameworkElement::Triggers Property

Gets the collection of triggers established directly on this element, or in child elements.

Namespace:  System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

public:
property TriggerCollection^ Triggers {
	TriggerCollection^ get ();
}
<object>
  <object.Triggers>
    oneOrMoreTriggers
  </object.Triggers>
</object>

XAML Values

oneOrMoreTriggers

One or more defined EventTrigger elements. Each such trigger is expected to contain valid storyboard actions and references. Note that this collection can only be established on the root element of a page. For more information, see Storyboards Overview.

Property Value

Type: System.Windows::TriggerCollection
A strongly typed collection of Trigger objects.

NoteNote

This property can only be set in Extensible Application Markup Language (XAML) through the collection syntax shown, or by accessing the collection object and using its various methods such as Add. The property to access the collection object itself is read-only, the collection itself is read-write. The property only exists on root elements; attempting to find it or set it elsewhere will cause an exception to be thrown.

This property does not enable you to examine triggers that exist as part of styles in use on this element. It only reports the collection of triggers that are literally added to the collection, either in markup or code. Elements do not typically have such elements existing by default (through a template for instance); it is more common for triggers that come from control compositing to be established in styles instead.

In terms of behavior (and trying to establish which effect came from which element's declared Triggers collection), both the triggering condition and the trigger effect might be on this element, or might be on its child elements in the logical tree. Note that if you use lifetime events such as Loaded to get this collection, the child element's triggers might not yet be fully loaded, and the collection will be smaller than it would truly be at run time.

Note that the collection of triggers established on an element only supports EventTrigger, not property triggers (Trigger). If you require property triggers, you must place these within a style or template and then assign that style or template to the element either directly through the Style property, or indirectly through an implicit style reference.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

Show:
© 2014 Microsoft