title: WPF Template Binding Path.Fill
body: <p>I have the following sytles:</p>
  
  <pre><code>&lt;Style x:Key="WindowButtonTriggers" TargetType="Button"&gt;            
          &lt;Style.Triggers&gt;
              &lt;Trigger Property="IsMouseOver" Value="True"&gt;
                  &lt;Setter Property="Background" Value="{StaticResource MainColorBrush}" /&gt;
              &lt;/Trigger&gt;
              &lt;Trigger Property="IsPressed" Value="True"&gt;
                  &lt;Setter Property="Background" Value="{StaticResource MainColorBrush}" /&gt;
              &lt;/Trigger&gt;
          &lt;/Style.Triggers&gt;
      &lt;/Style&gt;
      &lt;Style x:Key="MinimizeButton" TargetType="Button" BasedOn="{StaticResource WindowButtonTriggers}"&gt;
          &lt;Setter Property="Background" Value="{StaticResource WhiteBrush}" /&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="{x:Type Button}"&gt;
                      &lt;Canvas x:Name="appbar_minus" Width="48" Height="48" Clip="F1 M 0,0L 48,0L 48,48L 0,48L 0,0" Background="Transparent" UseLayoutRounding="False"&gt;
                          &lt;Rectangle Width="24" Height="4" Canvas.Left="12" Canvas.Top="24" Stretch="Fill" Fill="{TemplateBinding Background}" /&gt;
                      &lt;/Canvas&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;                        
      &lt;/Style&gt;
      &lt;Style x:Key="CloseButton" TargetType="Button" BasedOn="{StaticResource WindowButtonTriggers}"&gt;
          &lt;Setter Property="Background" Value="{StaticResource WhiteBrush}" /&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="{x:Type Button}"&gt;
                      &lt;Canvas x:Name="appbar_close" Width="48" Height="48" Clip="F1 M 0,0L 48,0L 48,48L 0,48L 0,0" Background="Transparent"&gt;
                          &lt;Path Width="20" Height="20" Canvas.Left="14" Canvas.Top="14" Stretch="Fill" Fill="{TemplateBinding Background}" Data="F1 M 17,14L 24,21L 30.9999,14.0001L 33.9999,17.0001L 27,24L 33.9999,31L 31,34L 24,27L 17,34L 14,31L 21,24L 14,17L 17,14 Z "/&gt;
                      &lt;/Canvas&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  </code></pre>
  
  <p>When I create a button with the style "MinimizeButton" it works fine (when the mouse is over the button color changes) but when I create a button with the style "CloseButton" it doesn't work and I don't understand why since they are almost the same style.</p>
  
  <p>Any help is greatly appreciated</p>
  
  <p><em>Edit</em></p>
  
  <pre><code>&lt;Grid&gt;
      &lt;Grid.ColumnDefinitions&gt;
          &lt;ColumnDefinition Width="*" /&gt;
          &lt;ColumnDefinition Width="100"/&gt;
      &lt;/Grid.ColumnDefinitions&gt;
      &lt;my:Menu Grid.Column="0" BorderThickness="0,0,1,0" BorderBrush="#FF777777"/&gt;
      &lt;WrapPanel Grid.Column="1" VerticalAlignment="Center" Margin="4,0,0,0"&gt;
          &lt;Button Style="{StaticResource MinimizeButton}" /&gt;            
          &lt;Button Style="{StaticResource CloseButton}" Command="Close" /&gt;      
      &lt;/WrapPanel&gt;
  &lt;/Grid&gt;
  </code></pre>