I have a user control that contains a combobox. I want to be able to edit the Items property for the combo box but im not really sure how to do that. I’ve tried adding the Items property to my user control class but im not sure what the value is thats returned when you set the property in the properties menu of visual studio. I have the property setup like this:
[Editor("System.Windows.Forms.Design.StringCollectionEditor, System.Design",
"System.Drawing.Design.UITypeEditor, System.Drawing")]
public ComboBox.ObjectCollection Items
{
get
{
return this.comboBox.Items;
}
set
{
this.comboBox.Items.Add(value);
}
}
Wrap the Items property of your UserControl’s ComboBox in a property like this:
The EditorAttribute in the property specifies the UI element used for changing the property in the designer.