Add design time support to wrapped user controls

I have my own ControlLibrary where I wrap a 3rd party StatusBar. I made my own collection of "Panels". Creating items in the collection at design time is not a problem. Also, runtime creation is not an issue. But if I create items at design time and I close the "Panel Collection Editor", the StatusBar is cleared and all my panels are gone. If I close the windows form and reopen it, the panels re-appear (That means the collection is correctly serialized to the source code file).

I use the following attributes: [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] for the collection property and [TypeConverter(GetType(ExpandableObjectConverter))] for the Panel class.

What happens to my panels if I close the "Panel Collection Editor"  With some debug code I found that the collection is always cleared and all items are added again...


Answer this question

Add design time support to wrapped user controls

  • Nolan Garrett

    This is the collectioneditor's default behavior (clear, re-add)
  • Add design time support to wrapped user controls