How to use an Items Collection Editor on a custom UserControl (.Net 4, Winforms)?
I created a UserControl that contains a custom ToolStrip Control. While using the UserControl throughout an application, the ToolStrip control cannot be accessed directly, as logically it's embedded in the UserControl. So, to access the items of the ToolStrip I defined a readonly property in the UserControl class that returns the items of the ToolStrip. Now programmatically the items of the ToolStrip can be edited by using the UserControl.Items property, but I cannot do the same in the design mode. Like someone drags the UserControl from the ToolBox to the form, goes to the property grid, chooses the Items property and manipulates the items of the ingrained ToolStrip accordingly; just as we do with any standard ToolStrip control's items collection with the help of Items Collection Editor. Herein, though the Items property of the UserControl shows in the property grid, it's not usable and every time I click, it shows an error message- 'Value cannot be null. Parameter name: value'. I'm sure this is because the property is declared just as readonly and I need to hike more so that when it is clicked in the property grid, the Items Collection Editor pops up with the items of the ToolStrip and can be handled consequently. So how should I be doing this?
Please state if I'm not clear.