This type of trigger fires when your condition is met, and then the effect disappears. To establish a good, not some time, take a look at this
<Button Content="Content" Background="Red"> <Button.Triggers> <EventTrigger RoutedEvent="MouseEnter"> <BeginStoryboard> <Storyboard> <ColorAnimation Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)" To="CadetBlue"/> </Storyboard> </BeginStoryboard> </EventTrigger> </Button.Triggers> </Button>
Since IsPressed is not a RoutedEvent, you can use this
<Button Content="Content" Background="Red"> <Button.Style> <Style TargetType="Button"> <Style.Triggers> <Trigger Property="IsPressed" Value="True"> <Trigger.EnterActions> <BeginStoryboard> <Storyboard> <ColorAnimation Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)" To="CadetBlue"/> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button>
source share