By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,967 Members | 1,596 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,967 IT Pros & Developers. It's quick & easy.

UserControl with a "Container panel" problems

P: n/a
Hi !

I would like to create a UserControl that act as a Collapsible Panel .

So I have a UserControl with two panels : a "Header panel" at the top, and a
"Container Area Panel" docked to fill the remaining client area of the
UserControl.

The "Header panel" is for Text, Icon,.

The "Container Area Panel" is to host all the Control dragged from the V.S.
toolbox.

How can I tell the designer that the "Container Area Panel" ONLY should
accept controls (dropped from the toolbox) ?

Actually my "Container Area Panel" has public modifiers.

I tried with that statement just above the declaration of my
CollapsiblePanel Class

[Designer(typeof(CollapsiblePanelDesigner))]

And I have made this class:

public class CollapsiblePanelDesigner : ParentControlDesigner

{

public override void Initialize(System.ComponentModel.IComponent
component)

{

base.Initialize(component);

CollapsiblePanel TmpCollapsiblePanel = component as CollapsiblePanel;

EnableDesignMode(TmpCollapsiblePanel.ClientPanel,
TmpCollapsiblePanel.ClientPanel.Name);
}

}

But this doesn't work .. I can drop controls on my CollapsiblePanel, but
designer allow to drop them also on the "Header Panel" (It shouldn't) . And
the Designer "forget" to add the controls to the "Container Area Panel" at
run time : in the InitializeComponent() the control on the CollapsiblePanel
are never added to the control (this line is missing [not generated]:
this.CollapsiblePanel1.Pan_Container.Controls.Add( Textbox1);)

Does anybody have an idea on what I'm missing ??

Thanks for any help or comments,

Steph.
Jul 20 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
OK, It works now !

I forgot to put the
"[DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content)]"
statement above the propety that publish the "Container Panel" :

[DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content)]
public Panel ContainerPanel
{
get
{
return Pan_Container;
}
}//EndProp ContainerPanel


"TheSteph" <Th******@NoSpam.comwrote in message
news:OV**************@TK2MSFTNGP03.phx.gbl...
Hi !

I would like to create a UserControl that act as a Collapsible Panel .

So I have a UserControl with two panels : a "Header panel" at the top, and
a
"Container Area Panel" docked to fill the remaining client area of the
UserControl.

The "Header panel" is for Text, Icon,.

The "Container Area Panel" is to host all the Control dragged from the
V.S.
toolbox.

How can I tell the designer that the "Container Area Panel" ONLY should
accept controls (dropped from the toolbox) ?

Actually my "Container Area Panel" has public modifiers.

I tried with that statement just above the declaration of my
CollapsiblePanel Class

[Designer(typeof(CollapsiblePanelDesigner))]

And I have made this class:

public class CollapsiblePanelDesigner : ParentControlDesigner

{

public override void Initialize(System.ComponentModel.IComponent
component)

{

base.Initialize(component);

CollapsiblePanel TmpCollapsiblePanel = component as CollapsiblePanel;

EnableDesignMode(TmpCollapsiblePanel.ClientPanel,
TmpCollapsiblePanel.ClientPanel.Name);
}

}

But this doesn't work .. I can drop controls on my CollapsiblePanel, but
designer allow to drop them also on the "Header Panel" (It shouldn't) .
And
the Designer "forget" to add the controls to the "Container Area Panel" at
run time : in the InitializeComponent() the control on the
CollapsiblePanel
are never added to the control (this line is missing [not generated]:
this.CollapsiblePanel1.Pan_Container.Controls.Add( Textbox1);)

Does anybody have an idea on what I'm missing ??

Thanks for any help or comments,

Steph.


Jul 20 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.