title: ElementName vs. RelativeResource?
body: <p>What of the following TextBlocks' Bindings costs more performance:</p>
  
  <pre><code>&lt;Window  
    x:Name="Me"
    x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:src="clr-namespace:WpfApplication1" 
    Title="MainWindow"&gt;
    &lt;StackPanel&gt;
      &lt;TextBlock Text="{Binding Title, ElementName=Me}"/&gt;
      &lt;TextBlock Text="{Binding Title, RelativeSource={RelativeSource AncestorType={x:Type src:MainWindow}}}"/&gt;
    &lt;/StackPanel&gt;    
  &lt;/Window&gt;
  </code></pre>
  
  <p>I am sure my question might take different when the TextBlocks are in a high nesting level having many siblings and ancestors.</p>
  
  <h2>Considerations</h2>
  
  <p>(based on personal thoughts only, I might be wrong in each particular one!):</p>
  
  <ul>
  <li><p><strong><code>ElementName</code></strong>:  </p>
  
  <ul>
  <li>Might search and compare current element to more control, thru all its children, siblings, uncles and great uncles including ancestors (maybe there is a HashTable of all the registered names?)</li>
  <li>Getting a <code>Name</code> property of a control should cost less performance than calling <code>GetType</code>.</li>
  <li>Comparing a string is cheaper than comparing types, especially when you know that most of the controls don't even have their <code>Name</code> set.</li>
  </ul></li>
  <li><p><strong><code>FindAncestor</code></strong>:</p>
  
  <ul>
  <li>Will only iterate thru ancestors, not siblingls 'uncles', 'cousins' etc.</li>
  <li>Most likely uses <code>GetType</code> to determine ancestor type; GetType costs more performance then a simple <code>Name</code> property getter (maybe DPs are different?)</li>
  </ul></li>
  </ul>