Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to retain default hover effect for my custom WPF RepeatButton
    text
    copied!<p>When I create a custom WPF control, I usually retain the usual default appearance and effects. For example, this includes the default blue hover over a button.</p> <p>I have created a custom TabControl with scrollable tabs. For whatever reason, the RepeatButton on each side (i.e. the left and right scroll arrows) have no hover effect. I have found several tutorials that tell me how to create my own hover effect for controls, but unfortunately these examples just replace the background with a different color (and this looks very different than having an animation which fades in transparent blue while keeping the underlying background). How can I get this hover effect? Is there some way that I can access the standard hover effect (might it be a storyboard?)?</p> <p>Edit: I have just discovered that if I remove the custom Style that I put on the RepeatButton, I get the default hover effect. Perhaps the question is then -- How did I destroy the hover effect, and how do I mildly modify appearance without destroying it? Below is the Style which borked the hover effect-</p> <pre><code> &lt;Style x:Key="TabScrollerRepeatButtonStyle" TargetType="{x:Type RepeatButton}"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate&gt; &lt;Border x:Name="testTest" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" Margin="1,0" CornerRadius="2"&gt; &lt;ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding ContentControl.Content}"/&gt; &lt;/Border&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&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