title: WPF Element Binding in a within a Resource control doesnt work
body: <p>I have some xaml that will just copy text from one text box to another:</p>
  
  <pre><code>&lt;StackPanel   Orientation="Horizontal"&gt;
      &lt;TextBox Width="100" Height="30" Text="{Binding ElementName=src1, Path=Text}"  /&gt;
      &lt;TextBox x:Name="src1" Width="100" Height="30" /&gt;
  &lt;/StackPanel&gt;
  </code></pre>
  
  <p>Nothing special, works fine. A bit dumb but just an example.
  However if I put the StackPanel as a resource in the Window and create dynamically from code, like this:</p>
  
  <pre><code>&lt;Window.Resources&gt;
      &lt;StackPanel  x:Key="MySP" Orientation="Horizontal"&gt;
          &lt;TextBox Width="100" Height="30" Text="{Binding ElementName=src, Path=Text}"/&gt;
          &lt;TextBox x:Name="src" Width="100" Height="30" /&gt;
      &lt;/StackPanel&gt;
  &lt;/Window.Resources&gt;
  </code></pre>
  
  <p>.. then the element binding doesnt work anymore. </p>
  
  <p>Why? and how to make it work? Any ideas gratefully received.</p>