To work with the property trigger, we will use a Label control in this example and trigger the system to change its various properties on mouse hover. Follow these simple steps:
- Open the MainWindow.xaml page and add the following Label control inside the grid:
<Grid> <Label Content="Hover over the text" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid>
- Inside the Window tag, create a Window.Resources tag to hold the style of the Label control. Create a Style inside the resources and set its TargetType to Button.
- Add the following trigger inside the style:
<Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="FontSize" Value="30"/> <Setter Property="Foreground" Value="Red"/> <Setter...