title: Get element inside a DataTemplate
body: <p>I have a following XAML and I need to change visibility of <code>imageRemoveButton</code> at runtime from the code behind file. How do I access that button?</p>
  
  <pre><code>&lt;ItemsControl x:Name="ImagesItemsControl"&gt;
      &lt;ItemsControl.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;Border BorderBrush="#ffdddddd"
                      BorderThickness="0,0,0,1"&gt;
                  &lt;Grid Margin="0,2"&gt;
                      &lt;Grid.ColumnDefinitions&gt;
                          &lt;ColumnDefinition Width="15" /&gt;
                          &lt;ColumnDefinition /&gt;
                          &lt;ColumnDefinition Width="20" /&gt;
                      &lt;/Grid.ColumnDefinitions&gt;
  
                      &lt;Grid Grid.Column="1"
                            VerticalAlignment="Center"&gt;
                          &lt;TextBlock Text="{Binding Name}"
                                        TextWrapping="Wrap" /&gt;
                      &lt;/Grid&gt;
                      &lt;Button Grid.Column="3"
                              Width="20"
                              Height="20"
                              Content="X"
                              Template="{StaticResource ButtonAddTab}"
                              Style="{StaticResource ButtonWizard}"
                              Tag="{Binding}"
                              x:Name="imageRemoveButton"
                              Click="ImageRemoveButton_Click" /&gt;
                  &lt;/Grid&gt;
              &lt;/Border&gt;
          &lt;/DataTemplate&gt;
      &lt;/ItemsControl.ItemTemplate&gt;
  &lt;/ItemsControl&gt;
  </code></pre>