Groups | Blog | Home
all groups > dotnet windows forms designtime > september 2006 >

dotnet windows forms designtime : Designer problem with inherited user control


mgauthier
9/19/2006 12:00:00 AM
I have a user control called "View" with a nested panel that correctly
accepts components at design time. I have derived another user control called
"FunctionView" from View where I want to add more components at design time.
However, the derived user control does not accept components when they are
dragged onto it at design time. The derived user control does not seem to
inherit the designer of the base class or its own designer is preventing
components from being added. Can someone help me with this issue? Do I need
to specify a designer again for the derived user control? I tried various
ways of doing this without success.

[Designer(typeof(ViewDesigner))]
public partial class View : UserControl
{
public View()
{
InitializeComponent();

}

[DesignerSerializationVisibility(DesignerSerializationVisibility.
Content)]
public Panel ViewPanel
{
get
{
return viewPanel;
}
set
{
viewPanel = value;
}
}
}

public class ViewDesigner : ControlDesigner
{
public override void Initialize(IComponent comp)
{

base.Initialize(comp);

View view = (View)comp;

EnableDesignMode(view.ViewPanel, "ViewPanel");

}
}

public partial class FunctionView: View
{
}
PureCode
9/23/2006 6:12:08 PM
Instead of 'ControlDesigner' use 'ParentControlDesigner' with your
ViewDesigner class.

Pure.

[quoted text, click to view]

AddThis Social Bookmark Button