title: Nested element in custom control is missing in the Visual Tree
body: <p>I do have two problems regarding custom controls:</p>
  
  <p>I created a custom UserControl</p>
  
  <pre><code>public partial class MyControl : UserControl
  {
  public static DependencyProperty ControlProperty = DependencyProperty.Register("Control", typeof(UIElement), typeof(MyControl ), null);
  
   public UIElement Control
          {
              get { return GetValue(ControlProperty) as UIElement; }
              set { SetValue(ControlProperty,value); }
          }
  }
  </code></pre>
  
  <p>Now I want to embed any "regular" control into my control using XAML</p>
  
  <pre><code>&lt;Grid&gt;
  &lt;own:MyControl&gt;
  &lt;own:MyControl.Control&gt;
  &lt;TextBox x:Name="txtTest" /&gt;
  &lt;/own:MyControl.Control&gt;
  &lt;/own:MyControl&gt;  
  &lt;/Grid&gt;
  </code></pre>
  
  <p>1) When trying to access the TextBox by its name in code-behind I just can't because it is null. What might the problem be? If I would place the same TextBox just inside the Grid the name would resolve to the instance as it should.</p>
  
  <p>2) I can't find my class using the VisualTreeHelper. The <em>GetChild</em> method just pretends my control isn't there. Why does this happen?</p>
  
  <p>Thank you in advance!</p>