How to: Use Triggers to Style a Button
This example shows how to use Trigger elements to style a Button control.
Example
The following example creates a style that changes the appearance of a Button in response to events that are raised on the control. When you move the mouse pointer over the Button, the Background color changes and if you click the Button, the Foreground color changes.
<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>
For the complete sample, see Button Styles Sample.
See Also
Tasks
How to: Create a Button
How to: Create a Button That Has an Image
How to: Use System Resources to Style a Button
Reference
Concepts
Button Overview
Resources Overview