'Populating combobox inside a listbox datatemplate based on another combox's selected item in WPF
In my wpf application, I have a Listbox control. Listbox control can have multiple rows. Inside the Listbox's DataTemplate I have two dropdowns in each row. For brevity,
<Listbox>
<ItemTemplate>
<DataTemplate DataType="{x:Type someModel}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<ComboBox Grid.Column="0" Name="ComboBox1" ItemSource="{Binding listData}">
</ComboBox>
<ComboBox Grid.Column="1" Name="ComboBox2" ItemSource="{Binding listData2}">
</ComboBox>
</Grid
</DataTemplate>
</ItemTemplate>
</Listbox>
My question is how can I update the ItemSource of ComboBox1 based on the selection of ComboBox2 of a particular row in the list?
See the picture below for more clarification about the requirement:

Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
