The idea
Recently I've been working on an MVC framework for the .Net compact framework, partly to aid the re-use of certain visual components, such as signature capture screens etc.
As visual inheritance has been supported for the compact framework from VS2005 this should make it very easy to provide a nice base implementation that can then be customised as required.
To this end I created a simple base frame to handle some common functionality and a number of input frames to handle different tasks.
The Problem
At this point the input frames had text overlaid on them in design mode:
Visual inheritance is currently disabled because the base class references a device-specific component or contains p/invoke
Annoying, as I wanted the design time support of being able to visually edit the frames as required.
The Solution
Initial research turned up an MSDN article that discussed this issue and mentioned a number of causes including P/Invokes and device specific code.
The article also states:
If you are sure that platform invoke will not be executed during design time, you can safely enable visual inheritance by putting a DesktopCompatible(true) attribute on the parent form or the parent user control.
This attribute can be applied in a DesignTimeAttributes.xmta file (added through the add file to solution dialog):
And...it still failed. 10 more minutes off hair pulling and I realised that fraLogin inherited from BaseFrame, so I added the attribute to that class too:
And now visual inhertance works!
Summary
So in short, if you want visual inheritance when developing with the compact framework, remember to add the DesktopCompatible attribute to any controls that will be derived from.