I've found many answers to this question, but I can't seem to get the syntax right. I've tried every logical combination I can think of given the explanation here and the many others I've found but it has still eluded me after three weeks. I just need to get the syntax of the XAML right.
Classes: (renamed for simplicity/confidentiality)
UserControl1 - Contains three global lists, called Streets, Houses, and Cars
Street - Contains two lists of only the associated Houses and Cars, called MyHouses and MyCars
House - Presented in a DataGrid, with one column being a DataGridComboboxColumn to choose which Street this House is associated with. Has a Street property called Street declared in it to keep track of this and do other calculations in get/set.
Car - Presented in a DataGrid, with one column being a DataGridComboboxColumn to choose which Street this Car is associated with. Has a Street property called Street declared in it to keep track of this and do other calculations in get/set.
If requested, I can refactor the code behind to match the above and post it.
XAML
<DataGrid ItemsSource="{Binding Streets, Mode=TwoWay}">
<DataGrid.Columns>
<DataGridTextColumn Header="Street" Binding="{Binding StreetID, Mode=TwoWay}"/>
</DataGrid.Columns>
</DataGrid>
<DataGrid ItemsSource="{Binding Cars, Mode=TwoWay}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding CarID, Mode=TwoWay}"/>
<DataGridComboBoxColumn
ItemsSource="{Binding Streets, RelativeSource={RelativeSource FindAncestor,AncestorType=UserControl1}, Mode=OneWay}"
SelectedItemBinding="{Binding Street}"
SelectedValue="{Binding StreetID}"
SelectedValuePath="StreetID"
DisplayMemberPath="StreetID">
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding Streets, RelativeSource={RelativeSource FindAncestor,AncestorType=UserControl1}, Mode=OneWay}"/>
<Setter Property="IsReadOnly" Value="True"/>
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding Streets, RelativeSource={RelativeSource FindAncestor,AncestorType=UserControl1}, Mode=OneWay}"/>
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
</DataGridComboBoxColumn>
</DataGrid.Columns>
</DataGrid>
<DataGrid ItemsSource="{Binding Houses, Mode=TwoWay}">
<!--copy of Cars with changed names-->
</DataGrid>