Changing Hyperlink foreground without losing hover color
Setting the Foreground directly (as you've done) doesn't work, and setting it in a Style doesn't work either, unless you "derive" that style from the default Hyperlink style (which must include the OnMouseOver trigger). So this works:
<TextBlock> <Hyperlink> <Hyperlink.Style> <Style TargetType="Hyperlink" BasedOn="{StaticResource {x:Type Hyperlink}}"> <Setter Property="Foreground" Value="#0C0"/> </Style> </Hyperlink.Style> Mark as done </Hyperlink></TextBlock>
Extracting that style back into the Window resources and referencing it with a key would probably make for more-readable XAML, but the above code does the job.
You should build your Hyperlink like this
<TextBlock Width="Auto" HorizontalAlignment="Center"> <Hyperlink Click="ForgotPassword_Clicked"> <TextBlock Text="Forgot Password?"/> </Hyperlink></TextBlock>
And then this style should work for you
<Style TargetType="{x:Type Hyperlink}"> <Setter Property="FocusVisualStyle" Value="{x:Null}"/> <Setter Property="Foreground" Value="Blue" /> <Setter Property="TextBlock.TextDecorations" Value="{x:Null}" /> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Foreground" Value="Red" /> <Setter Property="TextBlock.TextDecorations" Value="Underline" /> </Trigger> </Style.Triggers> </Style>