Represents a trigger that applies property values or performs actions conditionally.
Assembly: PresentationFramework (in PresentationFramework.dll)
[ContentPropertyAttribute("Setters")] [XamlSetTypeConverterAttribute("ReceiveTypeConverter")] public class Trigger : TriggerBase, IAddChild, ISupportInitialize
[ContentPropertyAttribute("Setters")] [XamlSetTypeConverterAttribute("ReceiveTypeConverter")] public ref class Trigger : TriggerBase, IAddChild, ISupportInitialize
[<ContentPropertyAttribute("Setters")>] [<XamlSetTypeConverterAttribute("ReceiveTypeConverter")>] type Trigger = class inherit TriggerBase interface IAddChild interface ISupportInitialize end
<ContentPropertyAttribute("Setters")> <XamlSetTypeConverterAttribute("ReceiveTypeConverter")> Public Class Trigger Inherits TriggerBase Implements IAddChild, ISupportInitialize
Gets a value that indicates whether this instance is currently sealed (read-only).(Inherited from DependencyObject.)
Gets a collection of Setter objects, which describe the property values to apply when the specified condition has been met.
Gets or sets the name of the object with the property that causes the associated setters to be applied.
Gets or sets the value to be compared with the property value of the element. The comparison is a reference equality check.
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)
Re-evaluates the effective value for the specified dependency property(Inherited from DependencyObject.)
Returns the local value of a dependency property, if it exists. (Inherited from DependencyObject.)
Handles cases where a type converter provides a value for a property of aobject.
Sets the value of a dependency property without changing its value source. (Inherited from DependencyObject.)
Sets the local value of a dependency property, specified by its dependency property identifier. (Inherited from DependencyObject.)
Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.(Inherited from DependencyObject.)
Returns a string that represents the current object.(Inherited from Object.)
This API supports the product infrastructure and is not intended to be used directly from your code. Signals the object that initialization is starting.
This API supports the product infrastructure and is not intended to be used directly from your code. Signals the object that initialization is complete.
Adds a child object.
Adds the text content of a node to the object.
WPF defines properties that correspond to end-user actions, such as the property that is set to true when the user hovers the cursor over a UIElement or the corresponding property of a ContentElement. Representing end-user actions in property values, along with the element, allows WPF styles to change property values based on those end-user actions, all from within markup.
The properties changed by triggers are automatically reset to their previous value when the triggered condition is no longer satisfied. Triggers are optimized for transient states which are expected to change and return to original state, such as on Button and on ListBoxItem. The of interest must be a dependency property.
The property of a object can only consist of Setter objects. Adding a Setter child to a object implicitly adds it to the SetterBaseCollection for the object. EventSetter objects are not supported; only supports EventSetter objects.
There are other types of triggers. MultiTrigger allows you to apply changes based on the state of multiple properties. EventTrigger allows you to apply changes when an event occurs. DataTrigger and MultiDataTrigger are for data-bound properties.
<Style x:Key="Triggers" TargetType="Button"> <Style.Triggers> <Trigger Property="IsPressed" Value="true"> <Setter Property = "Foreground" Value="Green"/> </Trigger> </Style.Triggers> </Style>
Available since 3.0
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.