Trigger.Setters Property

 

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

Namespace:   System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)

public SetterBaseCollection Setters { get; }

Property Value

Type: System.Windows.SetterBaseCollection

The default value is null.

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

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.

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.

.NET Framework
Available since 3.0
Return to top
Show: