I have a model, of the form:
public class A
{
public ObservableCollection B col1;
}
Public Class B
{
public int BA;
public int BB;
public ObservableCollection C;
}
public Class C
{
public int CA;
public int CB;
}
The first DataGrid is filled with the content of A, which is nothing more than a list of B elements.
<DataGrid x:Name="GrillaA" AutoGenerateColumns="False" IsReadOnly="True" SelectionMode="Single" ItemsSource="{Binding Mode=OneWay}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding BA}"/>
<DataGridTextColumn Binding="{Binding BB}"/>
</DataGrid.Columns>
</DataGrid>
And then I have another grid, which is filled with the contents of the list that contains B (the list of objects C)
<DataGrid x:Name="GrillaB" AutoGenerateColumns="False" IsReadOnly="True" SelectionMode="Single" ItemsSource="{Binding SelectedItem.C, ElementName=GrillaA}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding CA}"/>
<DataGridTextColumn Binding="{Binding CB}"/>
</DataGrid.Columns>
</DataGrid>
All this is perfect .. except that under each grid I have some textbox that are filled with the content of the selected row in the grid ... For the case of the first grid, I have no problem, they are filled to perfection ..
The question is: when I select an item in the GrillaA, how do I select the first element of the GrillaB, in a MVVM model, in such a way that the fields below that grid are filled?
EDITING
I leave an example in git:
and no, beyond the first screen, on the second screen when selecting an item from the first grid, the second grid does not select the first item (because the selection property is executed twice)