共用方式為


Triggers

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

<object>
  <object.Triggers>
    oneOrMoreEventTriggers
  </object.Triggers>
</object>
value = object.Triggers

XAML Values

Value

Description

oneOrMoreEventTriggers

One or more EventTrigger object elements. Each EventTrigger object element must specify the RoutedEvent attribute. You can specify multiple EventTrigger elements that have the same RoutedEvent value. For information about which events are supported in Silverlight 1.0, see the "Remarks" section in the EventTrigger reference topic.

Property Value

Type: TriggerCollection

A collection of triggers.

This property is read-only. The default value is null.

Managed Equivalent

Triggers

Remarks

The Triggers collection is populated by actions. Triggers is one of two places in the object model where you can place a storyboard for an animation. The other place is as an object in Resources.

The XAML syntax shown is the syntax for populating items in the TriggerCollection. You cannot replace the entire collection, either in XAML or in script. However, you can add items, remove items, and perform other operations with the existing collection contained by the Triggers property, both in XAML and in script.

Applies To

Border (Silverlight 2)

Canvas

Ellipse

Glyphs

Image

InkPresenter

Line

MediaElement

PasswordBox (Silverlight 2)

Path

Polygon

Polyline

Popup (Silverlight 2)

Rectangle

StackPanel (Silverlight 2)

TextBlock

TextBox (Silverlight 2)