How to: Use Triggers to Style a Button
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.