title: RelativeSource and Popup
body: <p>The problem is that <code>RelativeSource</code> does not work in the following case. I use silverlight 5.</p>
  
  <pre><code>//From MainPage.xaml
  &lt;Grid x:Name="LayoutRoot" Background="White" Height="100" Width="200"&gt;
      &lt;Popup IsOpen="True"&gt;
          &lt;TextBlock Text="{Binding Path=DataContext, RelativeSource={RelativeSource AncestorType=Grid}}" /&gt;
      &lt;/Popup&gt;
  &lt;/Grid&gt;
  
  //From MainPage.xaml.cs
  public MainPage()
  {
      InitializeComponent();
      DataContext = "ololo";
  }
  </code></pre>
  
  <p>If I set a breakpoint on the binding, I'll get Error:</p>
  
  <blockquote>
    <p>System.Exception: BindingExpression_CannotFindAncestor.</p>
  </blockquote>
  
  <p>If I use <code>ElementName=LayoutRoot</code> instead of <code>RelativeSource</code>, everything will be OK.</p>
  
  <p>Why does the relative source binding not work?</p>