Thursday, September 6, 2007

Using Visual Studio 2005 to Design Abstract Forms

Looking on how to workaround the problem of abstract forms that are not editable through the Visual Studio Designer, I found that interresting article:

Using Visual Studio Whidbey to Design Abstract Forms (thank you Brian)

Here are the summarized steps to perform in order to quick-kix the issue:
  1. Download Brian's project
  2. Add the GeneralConcreteClassProvider.cs class to your project
  3. Add that class in the same namespace than you abstract form, modifying the namespace
  4. Add the following code to the head of your abstract class:

    [TypeDescriptionProvider( typeof(GeneralConcreteClassProvider))]
    [ConcreteClass(typeof(GeneralConcreteForm))]

  5. Add the definition and implementation of the GeneralConcreteForm into your abstract form, and implement the abtract ptroperties, methods...

    #region Concrete version of AbstractForm for Designer

    // Here is a concrete version of AbstractForm that acts as a stand in

    internal class GeneralConcreteForm : UIForm

    {

     public override string AbstractProperty 
    {
    get { return null; }
    set { ; }
    }

    #endregion

  6. All you'll have to maintain, is the GeneralConcreteForm with the future abstract properties and methods.
  7. That's it


3 comments:

Anonymous said...

Thank you, this solution is very fast and works perfectly ! :)

Anonymous said...

Hi there. Sorry that .NET Compact Framework doesn't support the TypeDescriptionProvider class... The solution doesn't work with .NET Compact Fwk projects

Vivian said...

Great work.