Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you want to use the style to toggle the Background, you can't explicitly set the Background property as you have done here:</p> <pre><code>&lt;Button Background="LightGreen"&gt; </code></pre> <p>This will override any style you set. Try this instead:</p> <pre><code> &lt;Button.Style&gt; &lt;Style TargetType="Button"&gt; &lt;Setter Property = "Background" Value="LightGreen"/&gt; &lt;Style.Triggers&gt; &lt;Trigger Property="IsMouseOver" Value="true"&gt; &lt;Setter Property = "Background" Value="Green"/&gt; &lt;/Trigger&gt; &lt;Trigger Property="IsPressed" Value="true"&gt; &lt;Setter Property = "Foreground" Value="DarkGreen"/&gt; &lt;/Trigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; &lt;/Button.Style&gt; </code></pre> <p>This should make it so you can get rid of the button template, unless you want to do more in it.</p> <p>If you would like to get rid of the Aero nonsense, replace the template like so:</p> <pre><code> &lt;Button.Template&gt; &lt;ControlTemplate TargetType="{x:Type Button}"&gt; &lt;Border SnapsToDevicePixels="true" x:Name="Chrome" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"&gt; &lt;ContentPresenter Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/&gt; &lt;/Border&gt; &lt;/ControlTemplate&gt; &lt;/Button.Template&gt; </code></pre> <p>The drawback here is if you don't want Aero, you don't get any of it and you have to start from scratch with your template.</p>
 

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