Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF - Hyperlink style does not change with the style of label inside
    primarykey
    data
    text
    <p>Given the following XAML markup, I would expect the text in the Hyperlink to turn orange when I mouse over it, since I am setting a foreground colour on its parent control and it should filter down by <a href="http://msdn.microsoft.com/en-us/library/ms753197.aspx" rel="nofollow">Property Value Inheritance</a>. Yet it stays black. What do I need to do?</p> <pre><code>&lt;Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"&gt; &lt;Window.Resources&gt; &lt;Style x:Key="DemoLink" TargetType="{x:Type Hyperlink}"&gt; &lt;Style.Triggers&gt; &lt;Trigger Property="IsMouseOver" Value="True"&gt; &lt;Setter Property="Foreground" Value="DarkOrange" /&gt; &lt;/Trigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; &lt;/Window.Resources&gt; &lt;Grid&gt; &lt;Label&gt; &lt;Hyperlink Style="{StaticResource DemoLink}"&gt; &lt;Label Content="Text that should change colour on mouse over" /&gt; &lt;/Hyperlink&gt; &lt;/Label&gt; &lt;/Grid&gt; &lt;/Window&gt; </code></pre> <p><hr /> <b>Update:</b> The simple answer from Meleak is that using a TextBlock instead of the inner Label causes the style to work as expected - the TextBlock picks up the foreground colour from its parent, while the Label does not.</p> <p>e.g.</p> <pre><code>&lt;Label&gt; &lt;Hyperlink Style="{StaticResource DemoLink}"&gt; &lt;TextBlock Text="Text that does change colour on mouse over" /&gt; &lt;/Hyperlink&gt; &lt;/Label&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload