title: How to set focus to a bound ListboxItem by pressing its child element?
body: <p>I am developping a small WPF application which consist mostly in displaying <code>ObservableCollection&lt;&gt;</code> in others <code>ObservableCollection&lt;&gt;</code>, and so on.</p>
  
  <p>Here is a code example of what my application looks like:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;Listbox Name="MainList" ItemsSource={Binding}&gt;
      &lt;ListBox.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;StackPanel&gt;      
  
                  &lt;Textblock Text={Binding MainName} /&gt;
                  &lt;Button&gt;Add item&lt;/Button&gt;
                  &lt;Button&gt;Delete item&lt;/Button&gt;
  
                  &lt;Listbox Name="ChildList" ItemsSource="{Binding Path=ChildItem}"&gt;
                      &lt;ListBox.ItemTemplate&gt;
                          &lt;DataTemplate&gt;
                              &lt;Textblock Text={Binding ChildName} /&gt;
                          &lt;/DataTemplate&gt;
                      &lt;/ListBox.ItemTemplate&gt;
                  &lt;/Listbox&gt;
  
              &lt;/StackPanel&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListBox.ItemTemplate&gt;
  &lt;/Listbox&gt;
  </code></pre>
  
  <p>And visually it pretty much looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/YZ5HN.png" alt="Application example"></p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I will re-explain what I am trying to do.</p>
  
  <ul>
  <li><p>Whenever I click <code>Button A</code> or <code>Button B</code> I want to Select the <code>MainList</code> <code>ListBoxItem</code> in which they are contained (i.e: <code>A Item</code>)</p></li>
  <li><p>And in a second time whenever I click <code>Button B</code>:</p>
  
  <ul>
  <li>I want to be sure that a <code>ListBoxItem</code> is selected in <code>ChildList</code>(Second Listbox in the picture)</li>
  <li>And if so, I want to delete it in code-behind.</li>
  </ul></li>
  </ul>
  
  <p>But my main problem is since everything is generated by my bindings I cannot get, so far, an element from my <code>ChildList</code> because <code>ChildList</code> is duplicated in any of my <code>MainList</code> <code>ListBoxItem</code>.</p>