title: How can I access the ListViewItems of a WPF ListView?
body: <p>Within an event, I'd like to put the focus on a specific TextBox within the ListViewItem's template. The XAML looks like this:</p>
  
  <pre><code>&lt;ListView x:Name="myList" ItemsSource="{Binding SomeList}"&gt;
      &lt;ListView.View&gt;
          &lt;GridView&gt;
              &lt;GridViewColumn&gt;
                  &lt;GridViewColumn.CellTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;!-- Focus this! --&gt;
                          &lt;TextBox x:Name="myBox"/&gt;
  </code></pre>
  
  <p>I've tried the following in the code behind:</p>
  
  <pre><code>(myList.FindName("myBox") as TextBox).Focus();
  </code></pre>
  
  <p>but I seem to have misunderstood the <code>FindName()</code> docs, because it returns <code>null</code>.</p>
  
  <p>Also the <code>ListView.Items</code> doesn't help, because that (of course) contains my bound business objects and no ListViewItems.</p>
  
  <p>Neither does <code>myList.ItemContainerGenerator.ContainerFromItem(item)</code>, which also returns null.</p>