protected override void OnViewModelChanged(PropertyViewModel oldModel) { if (!dataPopulated) { if (ViewModel.IsConstrainedToPredefined) { this.popupButtonList.RemoveAllItems(); foreach (string item in ViewModel.PossibleValues) { popupButtonList.AddItem(new NSMenuItem(item)); } AddSubview(this.popUpButton); this.DoConstraints(new[] { popUpButton.ConstraintTo(this, (pub, c) => pub.Width == c.Width - 34), popUpButton.ConstraintTo(this, (pub, c) => pub.Height == DefaultControlHeight + 1), popUpButton.ConstraintTo(this, (pub, c) => pub.Left == pub.Left + 4), popUpButton.ConstraintTo(this, (pub, c) => pub.Top == pub.Top + 0), }); firstKeyView = this.popUpButton; lastKeyView = this.popUpButton; } else { this.comboBox.RemoveAll(); // Once the VM is loaded we need a one time population foreach (var item in ViewModel.PossibleValues) { this.comboBox.Add(new NSString(item)); } AddSubview(this.comboBox); this.DoConstraints(new[] { comboBox.ConstraintTo(this, (cb, c) => cb.Width == c.Width - 35), comboBox.ConstraintTo(this, (cb, c) => cb.Height == DefaultControlHeight), comboBox.ConstraintTo(this, (cb, c) => cb.Left == cb.Left + 4), comboBox.ConstraintTo(this, (cb, c) => cb.Top == cb.Top + 0), }); firstKeyView = this.comboBox; lastKeyView = this.comboBox; } dataPopulated = true; } base.OnViewModelChanged(oldModel); }