DataGridTextColumn を別の DataContext にバインドする必要があります。DaatGridComboBox でこれを正しく行っているため、これが可能であることはわかっています。私が現在持っているコードは
<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>
私が間違ったことをしましたか?
---- bindingProxy について --
記事にあるように BindingProxy クラスをセットアップしました。そしてこれを持って
<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>
しかし、なぜ要素「名前」を知っているのでしょうか?
乾杯