title: An object of the type "System.Windows.Controls.ControlTemplate" cannot be applied to a property that expects the type "System.Windows.Style"
body: <p>In my following code </p>
  
  <pre><code>&lt;StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="0"&gt;
              &lt;TextBlock Text="Opportunity" Height="25" Width="50"&gt;&lt;/TextBlock&gt;
              &lt;Button Height="25" Width="50" Style="{StaticResource SearchUCHeaderButtonsStyle}"&gt;
  
              &lt;/Button&gt;
              &lt;Button Height="25" Width="50"&gt;&lt;/Button&gt;
          &lt;/StackPanel&gt;
  </code></pre>
  
  <p>I am trying to use the  style which is written in Generic.Xaml and it is as followes</p>
  
  <pre><code>&lt;ControlTemplate x:Key="SearchUCHeaderButtonsStyle" TargetType="Button"&gt;
          &lt;Border Name="Border" CornerRadius="2" BorderThickness="1" Background="#C0C0C0" BorderBrush="#404040"&gt;
              &lt;ContentPresenter Margin="2" HorizontalAlignment="Center" VerticalAlignment="Center" RecognizesAccessKey="True"/&gt;
          &lt;/Border&gt;
          &lt;ControlTemplate.Triggers&gt;
              &lt;Trigger Property="IsKeyboardFocused" Value="true"&gt;
                  &lt;Setter TargetName="Border" 
                            Property="BorderBrush" Value="#202020" /&gt;
              &lt;/Trigger&gt;
              &lt;Trigger Property="IsDefaulted" Value="true"&gt;
                  &lt;Setter TargetName="Border" 
                            Property="BorderBrush" Value="#202020" /&gt;
              &lt;/Trigger&gt;
              &lt;Trigger Property="IsMouseOver" Value="true"&gt;
                  &lt;Setter TargetName="Border" 
                            Property="Background" Value="#808080" /&gt;
              &lt;/Trigger&gt;
              &lt;Trigger Property="IsPressed" Value="true"&gt;
                  &lt;Setter TargetName="Border" 
                            Property="Background" Value="#E0E0E0" /&gt;
                  &lt;Setter TargetName="Border" 
                            Property="BorderBrush" Value="#606060" /&gt;
              &lt;/Trigger&gt;
              &lt;Trigger Property="IsEnabled" Value="false"&gt;
                  &lt;Setter TargetName="Border" 
                            Property="Background" Value="#EEEEEE" /&gt;
                  &lt;Setter TargetName="Border" 
                            Property="BorderBrush" Value="#AAAAAA" /&gt;
                  &lt;Setter Property="Foreground" Value="#888888"/&gt;
              &lt;/Trigger&gt;
          &lt;/ControlTemplate.Triggers&gt;
      &lt;/ControlTemplate&gt;
  </code></pre>
  
  <p>But I am getting the following error -An object of the type "System.Windows.Controls.ControlTemplate" cannot be applied to a property that expects the type "System.Windows.Style"</p>
  
  <p>I need help in this.regards</p>