PersistChildrenAttribute class and collections in design-time prob

  • Thread starter A.J. van der Burg
  • Start date
A

A.J. van der Burg

Hi all,

I have a problem with maintaning the elements of a collection in design
time. I have a custom webcontrol, which in turn has a collection of child
controls. When I use the PersistChildenAttribute class, this collection is
not maintained when viewing the control in design time. In runtime,
everything is OK. Here are some designer settings of the classes involved:

[DefaultProperty("Tabs"),
DefaultEvent("SelectedIndexChanged"),
ToolboxData("<{0}:TabControl runat=server></{0}:TabControl>"),
ToolboxBitmap(typeof(TabControl), "Icons.TabControlIcon.bmp"),
Designer(typeof(TVW.Web.UI.Design.WebControls.TabControlDesigner)),
ParseChildren(true, "Tabs"),
PersistChildren(true)]

The collection has the following attributes:
[PersistenceMode(PersistenceMode.InnerDefaultProperty),
MergableProperty(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]

If I remove the PersistChildrenAttribute everything works ok in design-time,
but I want to persist the controls created at a lower level (within the
collection), so basically I'm stuck. Does anyone have any ideas?

TIA,

Arnold Jan van der Burg
 
N

Nicole Schenk

A.J. van der Burg said:
Hi all,

I have a problem with maintaning the elements of a collection in design
time. I have a custom webcontrol, which in turn has a collection of child
controls. When I use the PersistChildenAttribute class, this collection is
not maintained when viewing the control in design time. In runtime,
everything is OK. Here are some designer settings of the classes involved:

[DefaultProperty("Tabs"),
DefaultEvent("SelectedIndexChanged"),
ToolboxData("<{0}:TabControl runat=server></{0}:TabControl>"),
ToolboxBitmap(typeof(TabControl), "Icons.TabControlIcon.bmp"),
Designer(typeof(TVW.Web.UI.Design.WebControls.TabControlDesigner)),
ParseChildren(true, "Tabs"),
PersistChildren(true)]

The collection has the following attributes:
[PersistenceMode(PersistenceMode.InnerDefaultProperty),
MergableProperty(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]

If I remove the PersistChildrenAttribute everything works ok in
design-time, but I want to persist the controls created at a lower level
(within the collection), so basically I'm stuck. Does anyone have any
ideas?

TIA,

Arnold Jan van der Burg
Perhaps you need to write your own support for serialization.
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top