title: WPF Binding: How do I reference element outside a user control?
body: <p>My main window has following portion of XAML</p>
  
  <pre><code>&lt;StackPanel&gt;
   &lt;TextBox x:Name="textbox1" /&gt;
   &lt;my:UserControl1 /&gt;
  &lt;/StackPanel&gt;
  </code></pre>
  
  <p>my:UserControl1 goes like this</p>
  
  <pre><code>&lt;TextBox x:Name="userControlTextBox" /&gt;
  </code></pre>
  
  <p>I would like to bind the above textbox's Text property to Text property of the textbox outside. 
  I have tried</p>
  
  <pre><code>&lt;TextBox x:Name="userControlTextBox" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}, Path=textbox1.Text}" /&gt;
  </code></pre>