In my case this error appeared when I asigned to both dynamic created controls (combobox), same created control from other class.
//dynamic created controls
ComboBox combobox1 = ManagerControls.myCombobox1;
...some events
ComboBox combobox2 = ManagerControl.myComboBox2;
...some events
.
//method in constructor
public static void InitializeDynamicControls()
{
ComboBox cb = new ComboBox();
cb.Background = new SolidColorBrush(Colors.Blue);
...
cb.Width = 100;
cb.Text = "Select window";
ManagerControls.myCombobox1 = cb;
ManagerControls.myComboBox2 = cb; // <-- error here
}
Solution: create another ComboBox cb2
and assign it to ManagerControls.myComboBox2
.
I hope I helped someone.