title: How do I avoid binding to 2 datacontext
body: <p>My application looks like the following</p>
  
  <p><img src="https://i.stack.imgur.com/GRWNa.png" alt="enter image description here"></p>
  
  <p>The black is my MainWindow, the red is a tab control and the yellow is a UserControl.</p>
  
  <p>The UserControl has many Dependency Properties defined and they bind to the DataContext (Which is set in the MainWindow's code behind, using <code>this.DataContext = this</code>).</p>
  
  <p>To bind my UserControl to the same DataContext as my MainWindow, in my UserControl xaml I have the following </p>
  
  <pre><code>DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorLevel=1,AncestorType=Window}}"
  </code></pre>
  
  <p>This works great, and when I interact with my UserControl, due to the two way binding, it updates the Properties of my MainWindow, which in turn updates my TabControl!  </p>
  
  <p>The issue is, my UserControl now has some extra functionality and as such, needs to bind to the UserControl's code behind (such as values for the GUI). </p>
  
  <p>This is where I'm stuck. I can't bind from my UserControl to my code behind because I've already created a DataContext.</p>
  
  <p>I know I could use the WinForms approach, and name each control with x:Name="MyControl" like</p>
  
  <pre><code>MyControl.Text = "This value";
  </code></pre>
  
  <p>or</p>
  
  <pre><code>MyControl.DataContext = this;
  </code></pre>
  
  <p>Yeuk I think!!</p>
  
  <p>My question is, is this the only way to go, or can I still use binding.  </p>