Add ToolStripItemCollection property to designer

M

Mark Ingram

Hi, ive got a custom control, it basically has a label and a toolstrip.
i can add my control to the toolbox and add it to a form, but i'd really
like to be able to let the end developer add items to the toolstrip via
the properties panel. Ive add a public property "ToolStripItems" to my
control and it shows up in the designer, but when i click the "..."
button to edit the collection i get the following dialog:


"Value cannot be null.
Parameter name: value"


Ive looked at the ToolStrip item class and notice it uses some design
time serialisation:

[DesignerSerializer("System.Windows.Forms.Design.ToolStripCodeDomSerializer,
System.Design, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a",
"System.ComponentModel.Design.Serialization.CodeDomSerializer,
System.Design, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a")]

[Designer("System.Windows.Forms.Design.ToolStripDesigner, System.Design,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]


I tried adding these in to my class but it wont compile - complaining it
cant convert <mycontrol> to System.Windows.Forms.ToolStrip.

Any help on how i go about this?

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top