I need to bind a DataGridTextColumn to a different DataContext, I know this is possible as I am doing this correctly in a DaatGridComboBox. the code I have at the moment is
<DataGridTextColumn Header="Name" binding={wont work in here as this element is bounded to the itemsource of the DataGrid} IsReadOnly="True" Width="150">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="Text"
Value="{Binding DataContext.CustomerCollection.Name}"></Setter>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
What I have done wrong?
---- On bindingProxy --
I have setup the BindingProxy class how it is in the article. And have this
<DataGrid.Resources>
<l:BindingProxy x:Key="proxy" Data="{Binding}" />
</DataGrid.Resources>
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="Text"
Value="{Binding Data.Name, Source={StaticResource proxy}}"></Setter>
</Style>
</DataGridTextColumn.ElementStyle>
However, why would it know the element "Name"?
Cheers