I am trying to iterate the combobox items and it is always null.
Here is what I'm trying to accomplish:
foreach (ComboBoxItem Item in ListEditor.ComboBox.Items) { Item.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); if (Item.DesiredSize.Width > Width) Width = Item.DesiredSize.Width; }
ListEditor.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));ListEditor.Width = ListEditor.DesiredSize.Width + Width;
The ComboBox will not be null only when the editor is in edit mode, as the XamcomboEditor uses a comboBox when it is not in edit mode. if you execute this code when the editor is not in edit mode, then it would be null. You can access these items through the ItemsProvider or ItemsSource properties of the XamComboEditor
If you look at the code in the op you see that I trying to determine what the width of the combo needs to be based on the items in the drop down.