Inside the desired event, you can set the background color as follows:
// Change the background color of button1 to Blue
button1.Background = Brushes.Blue;
You can also set this in a trigger:
<Style TargetType="{x:Type Button}">
<Setter Property="Background" Value="Blue" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Yellow" />
</Trigger>
</Style.Triggers>
</Style>
More information can be found in the Property Triggers section of this article.
source
share