I'm banging my head on my keyboard; it seems that the solution to this should be much easier to find, but after a days work I still don't have an answer. Unfortunately, I'm completely new to working with data, I'm usually just automating processes, and have only been working with WPF for 3 or 4 months.
With that said, the concept is simple (think MS Access). I want to create a DataGrid that is capable of displaying a table (Jobs). A related table (JobParts) should be able to be added as a "subDataSheet" which displays only parts related to the job selected in the outer DataGrid, from all of my research it looks like it will go in the RowDetailsTemplate. I have the XAMl below, but it does not produce the desired results.
What I end up with is only the outer DataGrid rows being populated. *1* The inner DataGrid remains unpopulated. *2* Also, I realize that, with the way my code is written now, even if the inner grid was populated it wouldn't show only the related rows for the selected outer grid row, but rather, it would show all of the rows in the inner table.
Code Behind:
InitializeComponent();
PN10HistoryDataSet PN10History_ds = new PN10HistoryDataSet();
PN10HistoryDataSetTAbleAdapters.JobsTableAdapter Jobs_adapter = new PN10HistoryDataSetTAbleAdapters.JobsTAbleAdapter();
PN10HistoryDataSetTAbleAdapters.JobPartsTableAdapter JobParts_adapter = new PN10HistoryDataSetTAbleAdapters.JobPartsTAbleAdapter();
this.DataContext = PN10History_ds;
XAML:
<DataGrid
Name="objOuterDatagrid"
ItemsSource="{Binding Jobs}">
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<DataGrid
Name="objInnerDatagrid"
ItemsSource="{Binding JobParts}"></DataGrid>
</DataTemplate>
</DataGrid.RowDetailsTemplate>
</DataGrid>
Thanks in advance!