This post is to give an idea on how easily we can bind and create master details display in WPF.
Here I am using Northwind sample database and using Category and Products tables. These two tables are connected with each other through CategoryId. We will create a model using these two tables. Please ensure that you check the Foreign Key checkbox while selecting table in the EF4 model creation wizard.
Now, add two controls ListBox with id listBox1 and DataGrid with dataGrid1. Set the AutoGeneratedColumns to checked for the DataGrid.
Now open the Show Data Source from Visual Studio from Data Source menu.
Drop Category to listBox1 and Product (under Category) to dataGrid1. That’s all. Not a single line of code is required.
Hi. I am a newb. I tried this from scratch and with code in the zip--- I changed the data source to point to where Northwind is located on my C:\ in App.config connection string. In both cases, I opened the Data Source viewer and there were no Data Sources, just the message that I have no data sources and the link to click and "add a new Data Source." What am I missing?