Follow these steps to create a simple event trigger on a TextBlock control:
- Open the MainWindow.xaml and add the following TextBlock inside the Grid:
<TextBlock Text="Hover here" FontSize="30" Opacity="0.2" HorizontalAlignment="Center" VerticalAlignment="Center"> <TextBlock.Style> </TextBlock.Style> </TextBlock>
- Add the following style, containing EventTrigger, to the TextBlock.Style attribute:
<Style TargetType="TextBlock"> <Style.Triggers> <EventTrigger RoutedEvent="MouseEnter"> <EventTrigger.Actions> <BeginStoryboard> <Storyboard> <DoubleAnimation Duration="0:0:0.500" Storyboard.TargetProperty="FontSize" To="...