(0) exportieren Drucken
Alle erweitern
Dieser Artikel wurde noch nicht bewertet - Dieses Thema bewerten.

Style.Triggers-Eigenschaft

Gets a collection of TriggerBase objects that apply property values based on specified conditions.

Namespace: System.Windows
Assembly: PresentationFramework (in presentationframework.dll)
XML-Namespaces:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public TriggerCollection Triggers { get; }
/** @property */
public TriggerCollection get_Triggers ()

public function get Triggers () : TriggerCollection

<object>
  <object.Triggers>
    zeroOrMoreTriggers
  </object.Triggers>
</object>
 zeroOrMoreTriggers  Zero or more TriggerBase objects. 

Eigenschaftenwert

A collection of TriggerBase objects. The default is an empty collection.

The WPF styling and templating model enables you to specify triggers within your Style. Essentially, triggers are objects that enable you to apply changes when certain conditions (such as when a certain property value becomes true, or when an event occurs) are satisfied.

The following example shows a Style defined for Button controls. The Style defines two Trigger elements. The first Trigger changes the Background property of a Button when the IsMouseOver property is true. The second changes the Foreground property of a button when the IsPressed property is true.

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

Microsoft .NET Framework 3.0 wird unter Windows Vista, Microsoft Windows XP SP2 und Windows Server 2003 SP1 unterstützt.

.NET Framework

Unterstützt in: 3.0
Fanden Sie dies hilfreich?
(1500 verbleibende Zeichen)
Vielen Dank für Ihr Feedback.
Anzeigen:
© 2014 Microsoft. Alle Rechte vorbehalten.