Im trying to build a custom control using Windows Control Library (C# project). I am using a textbox and a listbox for this purpose.
I want to add new items to the listbox during the design time (by exposing some property which will allow me to edit the item collection of the listbox) and restore those items on the next run. Similar to the way when we add drag a listbox or a combobox item to a normal Windows forms application and access the 'Items' property which opens up a 'String Collection Editor' to add new items. In this case the items getting added to the designer file, so the values are retained the next time the form loads.
But how do I do that in the custom control. I have tried exposing the Items property of the Listbox, which is
public ListBox.ObjectCollection Items
{
get { return this.listBox1.Items; }
set { this.listBox1.Items.AddRange(value); }}
But this doesnt seem to wrok as it exposes an Item of type System.Object and does not allow me to add a string and retain it.
Thanks