title: What is the difference between x:Reference and ElementName?
body: <p>According to the <a href="http://msdn.microsoft.com/en-us/library/ee795380.aspx" rel="noreferrer">x:Reference Markup Extension</a> page on MSDN, <code>x:Reference</code></p>
  <blockquote>
  <p>References an instance that is declared elsewhere in XAML markup. The reference refers to an element's x:Name.</p>
  </blockquote>
  <p>According to the <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.binding.elementname.aspx" rel="noreferrer">Binding.ElementName Property</a> page on MSDN, <code>ElementName</code></p>
  <blockquote>
  <p>The value of the Name property or x:Name Directive of the element of interest.</p>
  </blockquote>
  <p>Looking back at the remarks section on the first page:</p>
  <blockquote>
  <p><strong>x:Reference and WPF</strong></p>
  <p>In WPF and XAML 2006, element references are addressed by the framework-level feature of ElementName binding. For most WPF applications and scenarios, ElementName binding should still be used. Exceptions to this general guidance might include cases where there are data context or other scoping considerations that make data binding impractical and where markup compilation is not involved.</p>
  </blockquote>
  <p>For completeness, here is part of the remarks section on the <code>ElementName</code> page:</p>
  <blockquote>
  <p>This property is useful when you want to bind to the property of another element in your application. For example, if you want to use a Slider to control the height of another control in your application, or if you want to bind the Content of your control to the SelectedValue property of your ListBox control.</p>
  </blockquote>
  <p>Now, while I am fully aware of when and how to use the <code>ElementName</code> property, I don't fully understand the difference between it and the <code>x:Reference</code> markup extension. Can anybody please explain this and in particular, expand on the last sentence shown from the <code>x:Reference</code> remarks section?:</p>
  <blockquote>
  <p>Exceptions to this general guidance might include cases where there are data context or other scoping considerations that make data binding impractical and where markup compilation is not involved.</p>
  </blockquote>