Actually the issue im facing is slight different than what title says. I try to sumarize the issue below.
Class PersonnelViewModel
{
public SelectedPersonne
You can access the parents datacontext using
Binding="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type DataGrid}}, Path=DataContext.ColumnName}"
So to add a column showing A's Property do
<DataGridTextColumn Header="Company" Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGrid}}, Path=DataContext.Company}"/>
Finally I managed to get it working. If I directly bind the property to the column header its not populating the value.
I had to do as following:
<DataGridTextColumn Binding="{Binding Name}">
<DataGridTextColumn.Header>
<TextBlock Text="{Binding DataContext.MyProp,
RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type Window}}}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>