Style::Setters Property

Gets a collection of Setter and EventSetter objects.

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:
property SetterBaseCollection^ Setters {
	SetterBaseCollection^ get ();
}
<object>
  <object.Setters>
    zeroOrMoreSetters
  </object.Setters>
</object>

XAML Values

zeroOrMoreSetters

Zero or more Setter and EventSetter objects.

The Setters property of a Style object can consist only of SetterBase objects. Adding a SetterBase child to a Style object implicitly adds it to the SetterBaseCollection for the Style object.

Property Value

Type: System.Windows::SetterBaseCollection
a collection of Setter and EventSetter objects. The default is an empty collection.

The following example shows how to use this property.

No code example is currently available or this language may not be supported.

Adding a SetterBase child to a Style object implicitly adds it to the SetterBaseCollection for the Style object. The following EventSetter is implicitly added to the SetterBaseCollection of the style:

<StackPanel
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="SDKSample.EventOvw2"
  Name="dpanel2"
>
  <StackPanel.Resources>
    <Style TargetType="{x:Type Button}">
      <EventSetter Event="Click" Handler="b1SetColor"/>
    </Style>
  </StackPanel.Resources>
  <Button>Click me</Button>
  <Button Name="ThisButton" Click="HandleThis">
    Raise event, handle it, use handled=true handler to get it anyway.
  </Button>
</StackPanel>

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5, 3.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft