title: What is DataContext for?
body: <p>As a continuation of the question <a href="https://stackoverflow.com/questions/7235403/linking-datacontext-with-another-property-in-wpf">Linking DataContext with another property in WPF</a>.</p>
  
  <p>At the very end of the research I was very surprised to find out that when one writes something like that:</p>
  
  <pre><code>&lt;Label Content="{Binding Path=Name}" /&gt;
  </code></pre>
  
  <p>The <code>DataContext</code> against which the <code>Content</code> property is binded is of the <code>Label</code> control itself! The fact that it still works is due to the default inheritance of the DataContext value from the nearest parent.</p>
  
  <p>But if you have this label wrapped in a custom control, and you don't want to bind your data to the <code>DataContext</code> property of that control, you would more likely love to have:</p>
  
  <pre><code>&lt;Controls:SearchSettings Settings="{Binding Path=Settings}" /&gt;
  </code></pre>
  
  <p>And here you are. Now you need to set <code>Settings</code> as the <code>DataContext</code> for the <code>SearchSettings</code> control, for <code>Label</code> inside to bind against, but you can't, because that will trigger re-binding of <code>Settings</code> property.</p>
  
  <p>I can't see the point in mixing binding properties using different sources: <code>DataContext</code>, by <code>ElementName</code>, etc.
  So why would I ever use <code>DataContext</code>?</p>