I need bind some ComboBoxes to one ObservableCollection.
I have this ListView.
<ListView x:Name="lwCoefTables" Grid.Column="1" ItemsSource="{Binding Source={StaticResource CollectionCoefContainers}}">
<ListView.ItemTemplate>
<DataTemplate>
<ComboBox x:Name="cmbCoefTableTypes" ItemsSource="{Binding Source={StaticResource CollectionCoefLinksTable}}"
SelectedItem="{Binding CoefLinksTableType, Mode=TwoWay}" Grid.Column="1" VerticalAlignment="Center"
HorizontalAlignment="Left" Width="180" DisplayMemberPath="Name">
</ComboBox>
</DataTemplate>
</ListView.ItemTemplate>
I want bind my collection to all ComboBoxes and save selected items for each ComboBox.
If I fill one collection and bind it to all comboboxes in TwoWay mode I get this:
I think I need helper class that will contain some similar collections. How to do that?
So I assume the
CoefLinksTableTypeproperty is on the items insideCollectionCoefContainers?In which case this should work, unless you have the same instance repeated inside
CollectionCoefContainers.e.g.
Something like this would behave as you describe.
The solution would be
It might be useful to have you definitions of
CollectionCoefContainersandCollectionCoefLinksTable