Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom Control Styling/Triggers Part II - Overriding Aero
    primarykey
    data
    text
    <p>This is a follow-up to <a href="https://stackoverflow.com/questions/4424699/overriding-button-background-in-wpf-on-aero">Overriding button background in WPF on Aero</a> and to a minor degree <a href="https://stackoverflow.com/questions/9622321/custom-control-styling-triggers">Custom Control Styling/Triggers</a>.</p> <p>In trying to keep the functionality of a ToggleButton but get rid of the button style, I followed the process of the first link above. It basically works, albeit with a minor modification of changing the <code>RenderMouseOver</code> and <code>RenderPressed</code> to <code>false</code> (Otherwise it was sensing the mouse being over anywhere in the window, rather than just when over the <code>ToggleButton</code>.</p> <p>So now my problem is, with the markup below, the <code>IsMouseOver</code> trigger doesn't change the background at all. Any ideas from looking at the XAML?</p> <p>On a side note, I was trying to use <code>BitmapEffect</code> to make the letters glow when toggled, but no matter what settings I use it doesn't seem to have an effect. Anyone know of a guide that deals specifically with this?</p> <pre><code>&lt;Style TargetType="{x:Type local:TimePicker}"&gt; &lt;Setter Property="Height" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Height}" /&gt; &lt;Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Width}" /&gt; &lt;Setter Property="HorizontalAlignment" Value="Center" /&gt; &lt;Setter Property="VerticalAlignment" Value="Center" /&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate&gt; &lt;Border Background="{TemplateBinding Background}" BorderBrush="Black" BorderThickness="1"&gt; &lt;StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="{TemplateBinding VerticalAlignment}"&gt; &lt;ToggleButton VerticalAlignment="{TemplateBinding VerticalAlignment}" Margin="0" Background="{TemplateBinding Background}" BorderBrush="Transparent" Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Hour}"&gt; &lt;ToggleButton.Template&gt; &lt;ControlTemplate TargetType="{x:Type ToggleButton}"&gt; &lt;Aero:ButtonChrome SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" RenderMouseOver="False" RenderPressed="False"&gt; &lt;ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /&gt; &lt;/Aero:ButtonChrome&gt; &lt;/ControlTemplate&gt; &lt;/ToggleButton.Template&gt; &lt;ToggleButton.Style&gt; &lt;Style TargetType="ToggleButton"&gt; &lt;Style.Triggers&gt; &lt;Trigger Property="IsMouseOver" Value="True"&gt; &lt;Setter Property="OverridesDefaultStyle" Value="True" /&gt; &lt;Setter Property="Background" Value="LightGray" /&gt; &lt;/Trigger&gt; &lt;Trigger Property="IsChecked" Value="True"&gt; &lt;Setter Property="Foreground" Value="Red" /&gt; &lt;Setter Property="FontWeight" Value="Bold" /&gt; &lt;Setter Property="BitmapEffect"&gt; &lt;Setter.Value&gt; &lt;OuterGlowBitmapEffect GlowColor="Red" GlowSize="30" /&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Trigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; &lt;/ToggleButton.Style&gt; &lt;/ToggleButton&gt; &lt;Label HorizontalContentAlignment="{TemplateBinding HorizontalAlignment}" VerticalContentAlignment="{TemplateBinding VerticalAlignment}" Content=":"/&gt; &lt;ToggleButton VerticalAlignment="{TemplateBinding VerticalAlignment}" Margin="0" Background="{TemplateBinding Background}" BorderBrush="Transparent" Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Minute}" /&gt; &lt;/StackPanel&gt; &lt;/Border&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&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.
 

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