Silverlight / WPF - Access and modify elements with ItemsControl.ItemsSource instead. Help needed

Asked By Ramesh Nalla on 27-Feb-14 12:33 AM
Hi Experts..!

I am getting the below error while adding a new item in WPF combo box. 


Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead.

please find the below code:
List<Empdetails> elist = iEI.GetEmployeeEmaiIds();
 if (cmbEmailIds.Items.Count == 0)
                {
    cmbEmailIds.Items.Clear();
                    cmbEmailIds.ItemsSource = elist;
                    cmbEmailIds.DisplayMemberPath = "EmailiId";
                    cmbEmailIds.SelectedValuePath = "EmailiId";
                }
                else
                {
                    
                    ComboBoxItem newItem=new ComboBoxItem();
                    newItem.Content=txtEmailId.Text.Trim();

                    cmbEmailIds.Items.Insert(cmbEmailIds.Items.Count, newItem);
                }

still waiting for your valuable responses..!

Thanks,
Ram