Note that there are some explanatory texts on larger screens.

plurals
  1. POTrigger on resource from resource
    text
    copied!<p>Is it possible to change a resource from another resource. I like to change the background of StartButtonRed if the mouse is over StartButtonMain.</p> <pre><code>&lt;ImageBrush x:Key="RedBackgroundActive" ImageSource="/Images/start_red_active.png" Stretch="Fill"/&gt; &lt;Style x:Key="StartButtonMain" TargetType="{x:Type local:SimpleButton}"&gt; &lt;Style.Resources&gt; &lt;ImageBrush x:Key="MainBackground" ImageSource="/Images/start_main_normal.png" Stretch="Fill"/&gt; &lt;ImageBrush x:Key="MainBackgroundActive" ImageSource="/Images/start_main_active.png" Stretch="Fill"/&gt; &lt;/Style.Resources&gt; &lt;Style.Setters&gt; &lt;Setter Property="HorizontalAlignment" Value="Stretch"/&gt; &lt;Setter Property="VerticalAlignment" Value="Stretch"/&gt; &lt;Setter Property="Background" Value="{StaticResource MainBackground}"/&gt; &lt;Setter Property="Visibility" Value="Visible"/&gt; &lt;/Style.Setters&gt; &lt;Style.Triggers&gt; &lt;Trigger Property="IsMouseOver" Value="True"&gt; &lt;Setter Property="Background" Value="{StaticResource MainBackgroundActive}"/&gt; // Change the background of StartButtonRed to RedBackgroundActive &lt;/Trigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; &lt;Style x:Key="StartButtonRed" TargetType="{x:Type local:SimpleButton}"&gt; &lt;Style.Resources&gt; &lt;ImageBrush x:Key="RedBackground" ImageSource="/Images/start_red_normal.png" Stretch="Fill"/&gt; &lt;/Style.Resources&gt; &lt;Style.Setters&gt; &lt;Setter Property="HorizontalAlignment" Value="Stretch"/&gt; &lt;Setter Property="VerticalAlignment" Value="Stretch"/&gt; &lt;Setter Property="Background" Value="{StaticResource RedBackground}"/&gt; &lt;Setter Property="Visibility" Value="Visible"/&gt; &lt;/Style.Setters&gt; &lt;/Style&gt; </code></pre>
 

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