title: XAML Itemscontrol binding to property outside of the control
body: <p>I have a list of transactions that I am loading into an ItemsControl but I want to show the UserId from my viewmodel in each row/transaction. The userId is not in the transaction list, it's a property in the viewmodel I am trying to access but it seems everything I've tried doesn't work and I don't know why. All I get is a blank column value. (yes, I did confirm the property is not empty. even hardcoded a value and got nothing). </p>
  
  <p>My understanding is I should be able to use the RelativeSource with an AncestorType of Window to access the property. Am I missing something?</p>
  
  <pre><code>&lt;ItemsControl ItemsSource="{Binding Path=MyReportResult.Transactions}" KeyboardNavigation.IsTabStop="False"&gt;
      &lt;ItemsControl.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;Grid Margin="20 2 0 2"&gt;
                  &lt;Grid.ColumnDefinitions&gt;
                      &lt;ColumnDefinition Width=".15*"/&gt;
                      &lt;ColumnDefinition Width=".15*"/&gt;
                  &lt;/Grid.ColumnDefinitions&gt;
              &lt;TextBlock Grid.Column="0" TextAlignment="Center" Margin="10 0 20 0" Text="{Binding Path=UserId, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"&gt;&lt;/TextBlock&gt;
              &lt;TextBlock Grid.Column="0" TextAlignment="Center" Margin="10 0 20 0" Text="{Binding Path=Amount}"&gt;&lt;/TextBlock&gt;
              &lt;/Grid&gt;
           &lt;/DataTemplate&gt;
      &lt;/ItemsControl.ItemTemplate&gt;
  &lt;/ItemsControl&gt;
  </code></pre>