title: How to refer to another XAML element inside a custom nested user control?
body: <p>I want to refer to another element, which resides as nested under a custom user control:</p>
  
  <pre><code>&lt;userControls:Test&gt;
       &lt;TextBox Name="Foo" /&gt;
  
       &lt;Button CommandParameter="{Binding Text, ElementName=Foo" Command="{Binding anything}" /&gt;
  &lt;/userControls:Test&gt;
  </code></pre>
  
  <p>Basically I'm using commands and I'm trying to refer to another element with a name, but I get this famous: </p>
  
  <blockquote>
    <p>Cannot set Name attribute value '...' on element '...'. '...' is under
    the scope of element '...', which already had a name registered when
    it was defined in another scope.</p>
  </blockquote>
  
  <p>I figured it's impossible to name an element: <a href="https://stackoverflow.com/questions/751325/how-to-create-a-wpf-usercontrol-with-named-content">How to create a WPF UserControl with NAMED content</a></p>
  
  <p>So is there any <em>other</em> way to refer to the element that would work inside nested custom user control content?</p>