1

The full .Net framework has an inherited UserControl but this option isn't offered by Visual Studio when creating a new control in a Compact Framework project.

Manually changing the ancestor class of a user control to another user control results in an exception being thrown by the designer when subsequently trying to open it.

Anyone know if user control inheritance is possible?

Mike Scott
  • 12,274
  • 8
  • 40
  • 53
  • You tried all of these things? http://stackoverflow.com/questions/49458/whats-the-state-of-play-with-visual-inheritance/49526#49526 – Quibblesome Feb 07 '10 at 14:44
  • Nothing works - the designer doesn't seem to support inheritance of user controls. The fact that there's no inherited user control in a mobile project hints that it's not possible ;-) – Mike Scott Feb 07 '10 at 22:46

2 Answers2

1

I have some notes on CF UserControls in this blog entry. The short of it is "Unless you plan to be a control vendor don't bother wasting your time even trying to get designer support working."

ctacke
  • 66,480
  • 18
  • 94
  • 155
  • Thanks, I gave up and went for splitting things up into user controls and reusing them, rather than subclassing. Even that is a PITA though, as I often get exceptions in the designer and have to fiddle around to fix things. VS seems very fragile in this area :-( – Mike Scott Feb 06 '10 at 14:46
0

I've had success running inherited controls but absolutely none within the designer. I've had to set the parent as Control to use the designer and then set it to my parent control prior to deploying (after closing the designer).

Austin Salonen
  • 49,173
  • 15
  • 109
  • 139
  • Good suggestion, but the whole idea of control inheritance in this case is to use the form designer so that I can add other controls in the subclass and line them up with those in the base class. I think I'll switch to composition rather than inheritance... – Mike Scott Feb 05 '10 at 18:01