I have table customer and table contract with one-many relationship (1 customer has many contracts)
I want to bind them into 1 datagrid that will list all of my customers and all contracts related to specific customer.
The SQL query is :
select * from vbdadvertisement.customer cus left join vbdadvertisement.contract con
on cus.id = con.Customer_id
I tried to create a datagrid bound into customer table then use :
<DataGridTextColumn Header="ContractNo" Binding="{Binding Path=contracts/ContractNo}" />
But this method will list only the first contract of customer instead of all of the contracts.
Am I missing something ?
take a look at the RowDetails property of the datagrid. you can then simply bind your “many” relationship to the details.