ComboBox: strange behaviour when adding items
Posted: 29 Apr 2014, 17:27
we are programmatically adding ComboBoxes to e.g. a StackPanel.
since noesisgui version 1.1.6 the items are displayed twice.
we narrowed it down to it being necessary that the items need to be added to the ComboBox before the ComboBox is added to e.g. the StackPanel.
but we need to fill the ComboBox after it has been added to the layout. which has worked before 1.1.6.
is this a bug, or did we do something wrong the whole time?
this doesn't work: (the combobox popup shows "test1 test2 test3 test1 test2 test3", but the combobox item count is 3)
StackPanel sp = FindName<StackPanel>("mainPanel");
ComboBox cb = new ComboBox();
sp.GetChildren().Add(cb);
cb.GetItems().Add("test1");
cb.GetItems().Add("test2");
cb.GetItems().Add("test3");
and this works: (the combobox popup shows "test1 test2 test3")
StackPanel sp = FindName<StackPanel>("mainPanel");
ComboBox cb = new ComboBox();
cb.GetItems().Add("test1");
cb.GetItems().Add("test2");
cb.GetItems().Add("test3");
sp.GetChildren().Add(cb);
since noesisgui version 1.1.6 the items are displayed twice.
we narrowed it down to it being necessary that the items need to be added to the ComboBox before the ComboBox is added to e.g. the StackPanel.
but we need to fill the ComboBox after it has been added to the layout. which has worked before 1.1.6.
is this a bug, or did we do something wrong the whole time?
this doesn't work: (the combobox popup shows "test1 test2 test3 test1 test2 test3", but the combobox item count is 3)
StackPanel sp = FindName<StackPanel>("mainPanel");
ComboBox cb = new ComboBox();
sp.GetChildren().Add(cb);
cb.GetItems().Add("test1");
cb.GetItems().Add("test2");
cb.GetItems().Add("test3");
and this works: (the combobox popup shows "test1 test2 test3")
StackPanel sp = FindName<StackPanel>("mainPanel");
ComboBox cb = new ComboBox();
cb.GetItems().Add("test1");
cb.GetItems().Add("test2");
cb.GetItems().Add("test3");
sp.GetChildren().Add(cb);