title: Find control in the visual tree
body: <p>I am trying to get my SelectedRadioButton from a DataTemplate.</p>
  
  <p>Wpf Inspector showed the Visual Tree:   </p>
  
  <p><img src="https://i.stack.imgur.com/7F3Rc.png" alt="enter image description here"></p>
  
  <p>and in code:</p>
  
  <pre><code>    void menu_StatusGeneratorChanged(object sender, EventArgs e)
              {
                  var status = Menu.Items.ItemContainerGenerator.Status;
                  if (status == System.Windows.Controls.Primitives.GeneratorStatus.ContainersGenerated)
                  {
                      var item = Menu.Items.ItemContainerGenerator.ContainerFromIndex(0);
                      // item is a ContentPresenter
                      var control = Tools.FindChild&lt;SelectedRadioButton&gt;(item);
                      control = Tools.FindAncestor&lt;SelectedRadioButton&gt;(item);
                  }
              }
  </code></pre>
  
  <p><code>item</code> is a ContentPresenter, see the image of Wpf inspector, I believe from there I must be able to get to the SelectedRadioButton. The variable <code>control</code> is always null.<br>
  What am I missing here? I use these <a href="http://rachel53461.wordpress.com/2011/10/09/navigating-wpfs-visual-tree/" rel="nofollow noreferrer">visualtreehelpers</a>.</p>