title: What's the DataContext of the Header elements inside a Hub control?
body: <p>I have started to develop for WP 8.1 using Windows Runtime recently, and I have faced a... "problem" that I don't seem to understand.</p>
  
  <p>The application I am currently developing uses a <code>Hub</code> control, and I would like to tweak its header's appearance slightly. To do so, I changed the <code>HeaderTemplate</code>attribute of the <code>Hub</code> control. However, as I tried to localize the textual content of the header (note that this is WinRT, the localization process is slightly different from the process in WP8 and can be found <a href="http://www.jayway.com/2014/04/22/windows-phone-8-1-for-developers-localizing-apps/" rel="nofollow">here</a>), I "accidentally" fixed the problem by making the template like this:</p>
  
  <pre><code>&lt;Hub.HeaderTemplate&gt;
      &lt;DataTemplate&gt;
          &lt;TextBlock Text="{Binding}"
                     Foreground="Red"/&gt;
      &lt;/DataTemplate&gt;
  &lt;/Hub.HeaderTemplate&gt;
  </code></pre>
  
  <p>I don't understand why it worked, though. When you do data binding like this (just using the expression <code>{Binding}</code>), doesn't the element get the same DataContext as its father? What's happening under the hood? Who's the parent element of the TextBlock, after all?</p>
  
  <p>Thanks in advance.</p>
  
  <h1>EDIT</h1>
  
  <p>As igrali asked, here is a more complete view of the XAML:</p>
  
  <pre><code>&lt;Page ...
        DataContext="{Binding Data, RelativeSource={RelativeSource Self}}"&gt;
      &lt;Grid Background="#FFF6DB"&gt;
      &lt;Hub Name="MainPageHub"
           x:Uid="MainPageHub"
           Margin="0,27,0,0"&gt;
          &lt;Hub.HeaderTemplate&gt;
              &lt;DataTemplate&gt;
                  &lt;TextBlock Text="{Binding}"
                             Foreground="White"/&gt;
              &lt;/DataTemplate&gt;
          &lt;/Hub.HeaderTemplate&gt;
  ...
  </code></pre>
  
  <p>Then, in the /Strings/en-US/Resources.resx, I have a "MainPageHub.Header" property set to "foobar" (just an example), and what I get as a header is actually "foobar" (which is what I wanted, but even so it seems confusing!).</p>