title: bind to a property in the parent control
body: <p>i have the following case:</p>
  
  <pre><code>Window
    |_Grid
        |_ListView (MainProductGrid)
             |_View
                 |_GridView
                      |_GridViewColumn
                               |_CellTemplate
                                       |_DataTemplate
                                               |_Label (LabelID)
  </code></pre>
  
  <p>now, i want to display in the LabelID the index of the row in the ListView.
  so i made the following:</p>
  
  <pre><code>&lt;ListView ItemsSource="{Binding Path=ProductItems}" AlternationCount="{Binding Path=ProductItems.Count}"&gt;
  ...
  </code></pre>
  
  <p>and for the label i have the following:</p>
  
  <pre><code>&lt;Label x:Name="LabelID" 
         Content="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, 
         Path=(ListView.AlternationIndex)}"/&gt;
  </code></pre>
  
  <p>but it LabelID is only showing 0..
  so i think the TemplatedParent is not pointing to the ListView control..
  so how can i correct the binding to point to the "upper parent" which is in my case the ListView ?</p>
  
  <p>thanks in advance</p>
  
  ################
  
  <p>Update: 
  here is the complete xaml ...</p>
  
  <pre><code>&lt;Grid x:Name="mainGrid"&gt;
          &lt;ListView  ItemsSource="{Binding Path=ProductItems}" AlternationCount="{Binding Path=ProductItems.Count}" x:Name="MainProductGrid"&gt;
                  &lt;ListView.View&gt;
                      &lt;GridView AllowsColumnReorder="False"&gt;
                      &lt;GridViewColumn x:Name="gvc" Header="id" Width="auto"&gt;
                          &lt;GridViewColumn.CellTemplate&gt;
                              &lt;DataTemplate&gt;
                                  &lt;Label Content="{Binding (ListView.AlternationIndex),RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListView}}}"/&gt;
                              &lt;/DataTemplate&gt;
                          &lt;/GridViewColumn.CellTemplate&gt;
                      &lt;/GridViewColumn&gt;
  
                      &lt;GridViewColumn Header="Product name" DisplayMemberBinding="{Binding Path=ProductName}"  Width="auto" /&gt;
                      &lt;/GridView&gt;
                  &lt;/ListView.View&gt;
              &lt;/ListView&gt;
      &lt;/Grid&gt;
  </code></pre>