演習と目的の 2 つのオブジェクトがあり、各演習には目的が 1 つあります。コード ビハインドでは、Exercises DataGrid の ItemsSource を設定します。
dgExercicios.ItemsSource = Repositorio<Exercicio>.GetAll();
そして私のXAMLで。
<DataGrid Name="dgExercicios" CellStyle="{StaticResource CellStyle}" CanUserSortColumns="True" CanUserResizeColumns="True" AutoGenerateColumns="False">
<DataGrid.Columns>
<!--This bind works (Exercice.Nome)-->
<DataGridTextColumn Header="Nome" Binding="{Binding Nome}" Width="200" />
<!--This bind DONT works (I Trying to bind to Exercise.Objective.Descricao)-->
<DataGridTemplateColumn Header="Objetivo" Width="80" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate >
<StackPanel>
<TextBlock Text="{Binding Path=Objective.Descricao}" T />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
私がやりたいことは、プロパティ Exercise.Objective.Descricao を Exercice.Nome の TextBlock にバインドすることです
別の質問ですが、この場合 DataGridTemplateColumn が必要ですか?