views:

704

answers:

0

Hello,

How can I get the Binding Path of an Element in a DataTemplate? My XAML looks like this:

        <GridViewColumn Header="Double">
            <GridViewColumn.CellTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding TotalValues, Mode=OneWay, StringFormat=\{0:0\'0.00\}, Converter={StaticResource GridValueConverter}}" TextAlignment="Right" Width="auto"/>
                </DataTemplate>
            </GridViewColumn.CellTemplate>
        </GridViewColumn>
        <GridViewColumn Header="Comments" DisplayMemberBinding="{Binding Path=Comments, Mode=OneWay}" Width="auto"/>

To get the Binding Path for the "normal" GridViewColumnHeader.DisplayMemberBinding is

var field = (string)((Binding)((GridViewColumnHeader)e.OriginalSource).Column.DisplayMemberBinding).Path.Path;

How can I get the same for the Binding Path of TextBlock.Text?

Thanks a lot!

Cheers