Export (0) Print
Expand All

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)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

public SetterBaseCollection Setters { get; }
<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.

Property Value

Type: System.Windows.SetterBaseCollection
The default value is null.

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>

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft