title: TargetName not recognized
body: <p>I am trying to enable and disable a <code>Button</code> based on selection in a <code>ListBox</code>. If a value is selected the button should be enabled.<br>
  I am trying to use triggers but it is giving me an error</p>
  
  <blockquote>
    <p>'targetname not recognized'.</p>
  </blockquote>
  
  <pre><code>&lt;UserControl x:Class="Qualification.View.QualificationView"
               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" 
               Height="500" Width="500"&gt;
      &lt;Grid&gt;
          &lt;Button Name="btnOpen"  Command="Open" CommandParameter="{Binding ElementName=lstName, Path=SelectedValue}"  Height="23" Width="100" Margin="259,325,141,152"&gt;Add Qualification&lt;/Button&gt;
          &lt;Grid.CommandBindings x:Uid="key"&gt;
              &lt;CommandBinding Command="Open" CanExecute="CommandBinding_CanExecute" Executed="CommandBinding_Executed"/&gt;
          &lt;/Grid.CommandBindings&gt;
          &lt;Grid.Resources&gt;
              &lt;Style TargetType="{x:Type TextBox}"&gt;
                  &lt;Style.Triggers&gt;
                      &lt;Trigger Property="Validation.HasError" Value="true"&gt;
                          &lt;Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self},
                                 Path=(Validation.Errors)[0].ErrorContent}"/&gt;
                      &lt;/Trigger&gt;
                  &lt;/Style.Triggers&gt;                
              &lt;/Style&gt;
              &lt;DataTemplate x:Key="eble"&gt;
                  &lt;DataTemplate.Triggers&gt;
                      &lt;DataTrigger Binding="{Binding Path=IsSelected,RelativeSource={RelativeSource TemplatedParent}}" Value="True"&gt;
                          &lt;Setter TargetName="btnOpen" Property="IsEnabled" Value="False"/&gt;
                      &lt;/DataTrigger&gt;
                  &lt;/DataTemplate.Triggers&gt;
              &lt;/DataTemplate&gt;
          &lt;/Grid.Resources&gt;
          &lt;Label Height="23" Width="100" Margin="17,35,383,442" RenderTransformOrigin="0.48,-3.217"&gt;Search&lt;/Label&gt;
          &lt;TextBox Name="txtSearch" Text="{Binding Qm.Search, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"  Height="23" Width="122" Margin="103,37,0,440" HorizontalAlignment="Left"&gt;&lt;/TextBox&gt;
          &lt;Button Name="btnGo"  Height="22" Width="30" Margin="205,37,265,441" RenderTransformOrigin="0.633,-1.318" Click="Button_Click_1"&gt;Go&lt;/Button&gt;
          &lt;ListBox Name="lstName"  ItemsSource="{Binding DocList}"  Width="218" Margin="17,82,265,152"&gt;
          &lt;/ListBox&gt;
          &lt;!--&lt;Button Command="{Binding AddQual}" CommandParameter="{Binding ElementName=lstName, Path=SelectedValue}"  Height="23" Width="100" Margin="259,325,141,152"&gt;Add Qualification&lt;/Button&gt;--&gt;
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>