title: WPF - Change ContentTemplate in DataTrigger of RepeatButton
body: <p>I got the following issue which I need some help with.</p>
  
  <p>(The code is simplified to show the problem I'm having)</p>
  
  <p>I got a repeat button with a contenttemplate and style:</p>
  
  <pre><code>&lt;UserControl x:Class="SR.Testing.MyUserControl"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
               mc:Ignorable="d"
               d:DesignHeight="450" d:DesignWidth="800"&gt;
  
  
    &lt;Grid&gt;
      &lt;Grid.RowDefinitions&gt;
        &lt;RowDefinition Height="Auto" /&gt;
      &lt;/Grid.RowDefinitions&gt;
      &lt;Grid.ColumnDefinitions&gt;
        &lt;ColumnDefinition Width="Auto" /&gt;
      &lt;/Grid.ColumnDefinitions&gt;
  
      &lt;Border x:Name="Border" SnapsToDevicePixels="True"&gt;
        &lt;StackPanel&gt;
          &lt;RepeatButton x:Name="IncreaseButton" ContentTemplate="{StaticResource ArrowUpNormal}" Style="{StaticResource IncreaseRepeatButtonStyle}" Click="IncreaseClick" /&gt;
        &lt;/StackPanel&gt;
      &lt;/Border&gt;
    &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>This is the datatemplate and the style:</p>
  
  <pre><code>  &lt;Geometry x:Key="UpArrowGeometry"&gt;M0,5 L4.5,.5 9,5 6,5 4.5,3.5 3,5 z&lt;/Geometry&gt;
  
    &lt;DataTemplate x:Key="ArrowUpNormal"&gt;
      &lt;Path Width="18"
            Height="10"
            Stretch="Fill"
            Data="{StaticResource UpArrowGeometry}"
            Fill="DarkOrange"
            SnapsToDevicePixels="True"
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            Focusable="False" /&gt;
    &lt;/DataTemplate&gt;
  
    &lt;DataTemplate x:Key="ArrowUpDisabled"&gt;
      &lt;Path Width="18"
            Height="10"
            Stretch="Fill"
            Data="{StaticResource UpArrowGeometry}"
            Fill="Green"
            SnapsToDevicePixels="True"
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            Focusable="False" /&gt;
    &lt;/DataTemplate&gt;
  
    &lt;Style x:Key="IncreaseRepeatButtonStyle" TargetType="{x:Type RepeatButton}"&gt;
      &lt;Setter Property="BorderThickness" Value="0" /&gt;
      &lt;Setter Property="Background" Value="Transparent" /&gt;
      &lt;Setter Property="Height" Value="40" /&gt;
  
      &lt;Style.Triggers&gt;
        &lt;Trigger Property="IsEnabled" Value="False"&gt;
          &lt;Setter Property="ContentTemplate" Value="{StaticResource ArrowUpDisabled}" /&gt;
        &lt;/Trigger&gt;
      &lt;/Style.Triggers&gt;
    &lt;/Style&gt;
  </code></pre>
  
  <p>After starting the application, the repeatbutton looks as intended (darkorange):</p>
  
  <p><img src="https://i.stack.imgur.com/zVf17.png" alt=""></p>
  
  <p>However, when I disable the RepeatButton (via codebehind) with "IncreaseButton.IsEnabled = false;"</p>
  
  <p>I expected my style trigger to turn the arrow green:</p>
  
  <p><img src="https://i.stack.imgur.com/hGb2r.png" alt=""></p>
  
  <p>But instead I get this (Arrow stays orange and the background turns white/gray):</p>
  
  <p><img src="https://i.stack.imgur.com/c8tcb.png" alt=""></p>
  
  <p>What is causing this behaviour and how do I fix this? Thanks!</p>