いくつかの ComboBoxes を 1 つの ObservableCollection にバインドする必要があります。私はこれを持っています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>
コレクションをすべての ComboBoxes にバインドし、ComboBox ごとに選択したアイテムを保存します。TwoWay モードで 1 つのコレクションを埋めてすべてのコンボボックスにバインドすると、次のようになります。
同様のコレクションを含むヘルパー クラスが必要だと思います。どうやってするか?