Re: User control with base class cannot be viewed in designer
- From: "....DotNet4Ever...." <hate.spam@xxxxxxxxxxx>
- Date: Fri, 3 Apr 2009 15:47:17 +0200
A further problem was that the base class is generic and the designer just craps out if the base class is generic. I did find a solution for that though, and that is to create a specific class that just inherits from the base generic class and then use this specific class (i.e. no generic parameters) as the base of the control.
"Jack Jackson" <jjackson-nsp@xxxxxxxxxxxxxxxx> wrote in message news:76p9t4t61hf9t27g01nbldmu9408m8619i@xxxxxxxxxx
This is a limitation of the designer. It needs to instantiate the
base class of the class you are designing. Since the base class is
abstract, it can't.
On Thu, 2 Apr 2009 15:30:24 +0200, "....DotNet4Ever...."
<hate.spam@xxxxxxxxxxx> wrote:
I am trying to develop several windows forms user controls for my
application, therefore all of these inherit from
System.Windows.Forms.UserControl as I drop them from the toolbox into the
design surface. I created the user control on the design surface and added
the other winform controls that are grouped into that user control. At this
point it shows fine in the designer. At this point I have
// SomeCompositeControl.cs
public partial class SomeCompositeControl : System.Windows.Forms.UserControl
{
}
// SomeCompositeControl.Designer.cs
public partial class SomeCompositeControl
{
private System.ComponentMode.IContainer components = null;
:
}
Well, In all my winforms and user controls I follow the same pattern. For
that reason I wanted to create an abstract base class for my user control (I
named it MementoUserControlBase):
public abstract class MementoUserControlBase :
System.Windows.Forms.UserControl
{
:
}
and then my user control would be:
// SomeCompositeControl.cs
public partial class SomeCompositeControl : MementoUserControlBase
{
}
// SomeCompositeControl.Designer.cs
public partial class SomeCompositeControl
{
private System.ComponentMode.IContainer components = null;
:
}
The problem is the moment I use the custom base class approach then when I
open my control designer surface rather than being greeted by my carefully
arranged custom user control I get:
"The designer could not be shown for this file because none of the classes
within it can be designed. The
designer inpsected the following classes in the file:
SomeCompositeControl -- the base class 'MementoUserControlBase' could not
be loaded. Ensure the asembly has been referenced and that all projects have
been built"
Both the user control (SomeCompositeControl) and the base class
(MementoUserControlBase) build properly and are in the same project. The
entire project builds without errors.
So, what is wrong here? what sort of weird designer intricacy am I missing?
Emilio
.
- References:
- User control with base class cannot be viewed in designer
- From: ....DotNet4Ever....
- Re: User control with base class cannot be viewed in designer
- From: Jack Jackson
- User control with base class cannot be viewed in designer
- Prev by Date: RE: WinForms app with Vista icon
- Next by Date: Legacy ActiveX control showing black background
- Previous by thread: Re: User control with base class cannot be viewed in designer
- Next by thread: Playing Videos in .Net
- Index(es):
Relevant Pages
|