title: C#/WPF: Get Binding Path of an Element in a DataTemplate
body: <p>How can I get the Binding Path of an Element in a DataTemplate?
  My XAML looks like this:  </p>
  
  <pre><code>&lt;GridViewColumn Header="Double"&gt;
      &lt;GridViewColumn.CellTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;TextBlock Text="{Binding TotalValues, Mode=OneWay, StringFormat=\{0:0\'0.00\}, Converter={StaticResource GridValueConverter}}" TextAlignment="Right" Width="auto"/&gt;
          &lt;/DataTemplate&gt;
      &lt;/GridViewColumn.CellTemplate&gt;
  &lt;/GridViewColumn&gt;
  &lt;GridViewColumn Header="Comments" DisplayMemberBinding="{Binding Path=Comments, Mode=OneWay}" Width="auto"/&gt;
  </code></pre>
  
  <p>To get the Binding Path for the "normal" GridViewColumnHeader.DisplayMemberBinding is  </p>
  
  <pre><code>var field = (string)((Binding)((GridViewColumnHeader)e.OriginalSource).Column.DisplayMemberBinding).Path.Path;
  </code></pre>
  
  <p>How can I get the same for the Binding Path of <code>TextBlock.Text</code>?</p>