title: Ancestor binding of Tag Dependency Property fails with Property not found
body: <p>I’m building a MEF based module loading framework … the basic layout is that the main MEF application loads modules and data binds to various exported object including the module’s Ribbon and the modules main view (as a UserControl).</p>
  
  <p>In the modules the Ribbon is defined in one XAML file as a ResourceDictionary and the main view (the module’s window content) is defined in a separate XAML file as a UserControl.</p>
  
  <p>The MEF Framework App’s main window XAML binds the module’s usercontrol and ribbon.  With the ribbon it also links the Ribbon’s Tag dependency property to the UserControl.  This way the actual Module Ribbon can access the UserControl (for things like determining what elements are selected in a grid). </p>
  
  <p>This all works fine … the Tag is properly associated with the UserControl.  The problem I run into is in the module’s Ribbon.  I try to bind to subelements in the UserControl and the binding fails.  Here is an example of the module’s ribbon binding that is failing:</p>
  
  <pre><code>&lt;ribbon:RibbonButton
     Command=”blah”
     Label={“Binding RelativeSource={RelativeSource AncestorType=ribbon:Ribbon},
     Path=Tag.Username.Text}”/&gt;
  </code></pre>
  
  <p>As I mentioned Tag is properly resolved to the module’s UserControl … but I then get a binding error on Username (property not found).</p>
  
  <p>Here is how I bind the Tag property in the MEF Framework App’s main window:</p>
  
  <pre><code>&lt;ribbon:Ribbon x:Name=”Ribbon”
     DataContext=”blah”,
     Tag=”{Binding ElementName=RibbonWindow,              
     Path=DataContext.ModuleList.CurrentItem.View}”&gt; 
  </code></pre>
  
  <p>BTW I’m a little hamstrung in the fact that I can’t use Prism … </p>