Trigger.Setters Property

Definition

Gets a collection of Setter objects, which describe the property values to apply when the specified condition has been met.

public:
 property System::Windows::SetterBaseCollection ^ Setters { System::Windows::SetterBaseCollection ^ get(); };
public System.Windows.SetterBaseCollection Setters { get; }
member this.Setters : System.Windows.SetterBaseCollection
Public ReadOnly Property Setters As SetterBaseCollection

Property Value

The default value is null.

Examples

As mentioned above, adding a Setter child to a Trigger object implicitly adds it to the SetterBaseCollection for the Trigger object. In the following example, <Trigger.Setters> is implicit.

    <ControlTemplate.Triggers>
      <Trigger Property="IsSelected" Value="True">
<Trigger.Setters>
           <Setter Property="Opacity" Value="1.0" />
</Trigger.Setters>
      </Trigger>
    </ControlTemplate.Triggers>

Remarks

XAML Property Element Usage

<object>
  <object.Setters>
    ZeroOrMoreSetters
  </object.Setters>
</object>

XAML Values

ZeroOrMoreSetters Zero or more Setter objects. This does not support EventSetter object.

A Trigger allows you to use Setters to apply property values when the element meets a specified condition. For example, you may want to change the background color of an element when it is in focus.

If the same property is set more than once, the last property value will be applied.

The Setters property of a Trigger object can only consist of Setter objects. Adding a Setter child to a Trigger object implicitly adds it to the SetterBaseCollection for the Trigger object. EventSetter objects are not supported; only Style.Setters supports EventSetter objects.

Applies to