title: Name cannot be found in the name scope of 'System.Windows.Controls.Button'
body: <p>I have the following <code>Template</code> for my <code>Button</code></p>
  
  <pre><code>&lt;Window.Resources&gt;
      &lt;DataTemplate x:Key="ItemTemplate"&gt;
          &lt;DockPanel Width="Auto"&gt;
              &lt;Button DockPanel.Dock="Top"&gt;                                           
                  &lt;Button.Template&gt;
                      &lt;ControlTemplate &gt;
                          &lt;Image  Source="{Binding image}"/&gt;
                      &lt;/ControlTemplate&gt;
                  &lt;/Button.Template&gt;                    
                  &lt;Button.Triggers&gt;
                      &lt;EventTrigger RoutedEvent="Button.Click"&gt;
                          &lt;BeginStoryboard&gt;
                              &lt;Storyboard&gt;
                                  &lt;local:GridLengthAnimation
                                      Storyboard.TargetName="col1"
                                      Storyboard.TargetProperty="Width"
                                      LeftGridWidth="*" RightGridWidth="1*" Duration="0:0:2"/&gt;
                              &lt;/Storyboard&gt;
                          &lt;/BeginStoryboard&gt;
                      &lt;/EventTrigger&gt;
                  &lt;/Button.Triggers&gt;
              &lt;/Button&gt;
          &lt;/DockPanel&gt;
      &lt;/DataTemplate&gt;
  &lt;/Window.Resources&gt;
  
  &lt;Grid&gt;
       ...
       ...
       &lt;Grid Grid.Row="2" &gt;
  
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition Name="col1" Width="{Binding ElementName=root, Path=DataContext.gla.LeftGridWidth}" /&gt;
              &lt;ColumnDefinition Name="col2" Width="{Binding ElementName=root, Path=DataContext.gla.RightGridWidth}" /&gt;
          &lt;/Grid.ColumnDefinitions&gt;
  
          &lt;Grid x:Name="LeftGrid" Grid.Row="2" Grid.Column="0" &gt;
                &lt;Border BorderThickness="1" BorderBrush="Red"&gt;
                    &lt;ItemsControl ItemTemplate="{StaticResource ItemTemplate}" ItemsSource="{Binding ElementName=root, Path=DataContext._movies}"&gt;
                        &lt;ItemsControl.ItemsPanel&gt;
                            &lt;ItemsPanelTemplate&gt;
                                &lt;UniformGrid Columns="5"/&gt;
                            &lt;/ItemsPanelTemplate&gt;
                        &lt;/ItemsControl.ItemsPanel&gt;
                    &lt;/ItemsControl&gt;
                &lt;/Border&gt;
          &lt;/Grid&gt;
       &lt;/Grid&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>The issue is that <code>col1</code> is not being picked up by <code>Storyboard.TargetName="col1"</code>. I receive the error:</p>
  
  <p><code>An unhandled exception of type 'System.InvalidOperationException' occurred in PresentationFramework.dll</code></p>
  
  <p><code>Additional information: 'col1' name cannot be found in the name scope of 'System.Windows.Controls.Button'.</code></p>
  
  <p>I think it may have to do with the fact that I'm using <code>Items Control</code>... I thought that <code>col1</code> would be tried to be found in any containing elements. I'm not sure how to resolve this issue.</p>
  
  <p>Any help would be greatly appreciated!</p>