c# - Strange issue involving disappearing items -
I have found a combo box which is in the form of an objectable collection as its item source. Thus, the combo box is made up of labels.
I have many user controls that can be created by the user, and each of these UserControls can have many combo boxes. When user control is created, a label with the name of UserControl is added to the ObserveClub, thus each combo box whose item source is Observeable Collection, will now also include the latest label.
Everything is fine, and combo boxes are populated as new use controls are produced as expected, however, a very strange case is arising.
When the user opens the Combo box drop down menu of a UserControl, he can see all the labels properly.
Then, when the user opens in the Combo box drop down menu of any other user control, the items are all displayed in the same way. The strange issue now is that when the user goes back to the combo box of the previous user controller, the items disappear. The labels are still there, as I have debug it and found that the labels are still contained in the item, although it seems that their height has been set to 0 (on debugging it was found that their height 0 is not, but the fact in 26).
The same amount of labels is included, and as seen in the screenshot above, they are selectable, although they are not visible (can be shown just by selecting something ) I'm not changing the height of the label anywhere.
A user has commented that the WPF cache archive is archived by the archive, so shares the same instance of the collection view in all the comboboxes. Therefore, only one view parent can have a label, so when the user extends the second combo box, it separates the label from the first one. Here's the solution to change your I hope it helps. combobox in this way and Visit your
Observe Collection & lt; T & gt; Bind the
combo box to <. Note that you will see
ObservableCollection & lt; Label & gt; to
ObsavableCollection & lt; String & gt; .
& lt; ComboBox should change x: name = "cmb1" height = "24" margin = "0,27,0,0" workspaceElement = "top" width = "131" & gt; & Lt; ComboBox.ItemTemplate & gt; & Lt; DataTemplate & gt; & Lt; Label content = "{binding}" /> & Lt; / DataTemplate & gt; & Lt; /ComboBox.ItemTemplate> & Lt; / ComboBox & gt;
Comments
Post a Comment