Trigger.Value Property


Gets or sets the value to be compared with the property value of the element. The comparison is a reference equality check.

 property System::Object ^ Value { System::Object ^ get(); void set(System::Object ^ value); };
[System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)]
public object Value { get; set; }
member this.Value : obj with get, set
Public Property Value As Object

Property Value

The default value is null. See also the Exceptions section.



Expressions such as bindings are not supported.

After a Trigger is in use, it cannot be modified.


The following example changes the Foreground property of a button when the IsPressed property is true.

<Style x:Key="Triggers" TargetType="Button">
    <Trigger Property="IsPressed" Value="true">
        <Setter Property = "Foreground" Value="Green"/>


This value is compared with the property value returned by the Property property of the Trigger. The comparison that is performed is a reference quality check. If the two values are equal, then the associated Setters apply the specified property values.

Note that you must specify both the Property and Value properties on a Trigger for the trigger to be meaningful. Therefore, if one or both of the properties are not specified, then an exception is thrown.

XAML Property Element Usage


Applies to

See also