I have combo box in wpf application. On combo box selectionChanged event i have added one more item in combo box. I have bind the combo box with wvvm architecture. On selectionchanged my list updated but combo box item not refresh. My xaml code as follow:
<ComboBox Name="cmb" SelectionChanged="cmb_SelectionChanged"
ItemsSource="{Binding Source={StaticResource cmbList}}"
SelectedValue="{Binding Listvalue}" DisplayMemberPath="ItemName" SelectedValuePath="itemName" >
</ComboBox>
I have use following code for sectionChanged:
private void cmb_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
DropDownItem newItemsValue = new DropDownItem { ID = 1, itemName = "newValue", strID = "newValue" };
this.objcmbList.cmbList.Add(newItemsValue);
(FindResource("CmbList") as ObjectDataProvider).ObjectInstance = this;
(FindResource("CmbList") as ObjectDataProvider).Refresh();
}
Here my list has been updated but combo box not updated. May be Error is combo box in use. so how can i refresh my combo box item on selection changed event.