Binding DataGridTemplateColumn Binding DataGridTemplateColumn wpf wpf

Binding DataGridTemplateColumn


I'm not completely sure what you're trying to do but if you need to get the DataContext of the whole row, you can use a RelativeSource binding to walk up the visual tree. Like so:

<DataTemplate x:Key="DoubleField">    <StackPanel>        <TextBlock Text="{Binding DataContext.Value1, RelativeSource={RelativeSource AncestorType=DataGridRow}}"/>        <TextBlock Text="{Binding DataContext.Value2, RelativeSource={RelativeSource AncestorType=DataGridRow}}"/>    </StackPanel></DataTemplate>