Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / IDE / April 2006

Tip: Looking for answers? Try searching our database.

GetView() and SupportedTechnologies not called

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark Olbert - 16 Apr 2006 02:06 GMT
I'm porting a wizard library from v1.1/VS2003 to v2/VS2005.

Part of the library involves custom designers for components. These involve the following pattern:

[
Designer(typeof(WizardRootDesigner), typeof(IRootDesigner)),
]
public class Wizard : System.ComponentModel.Component, IPageInfoCollection
{
    //...implementation details
}

public class WizardRootDesigner : ComponentDocumentDesigner, IRootDesigner
{
    //...other stuff

    public object GetView(System.ComponentModel.Design.ViewTechnology technology)
    {
        if( theView == null ) theView = new WizardDesignerViewHost();
        return theView;
    }

    public System.ComponentModel.Design.ViewTechnology[] SupportedTechnologies
    {
        get
        {
            return new ViewTechnology[] { ViewTechnology.Default };
        }
    }
}

However, neither GetView() nor SupportedTechnologies ever gets called (they both were called properly under v1.1/VS2003). This
causes problems for my custom designer, since theView never gets initialized under v2/VS2005.

I noticed that NET2 sports a bunch of changes in the area of custom designers (e.g., DesignSurface, DesignSurfaceManager). Has the
v1.1 approach to creating custom designers been obsoleted? What approach should I be using under v2/VS2005?

- Mark
Mark Olbert - 16 Apr 2006 03:15 GMT
I spoke too soon: the changed behavior from v1.1/VS2003 is not that GetView() and SupportedTechnologies don't get called. They just
get called later.

Here's a somewhat more detailed code snippet:

[
Designer(typeof(WizardRootDesigner), typeof(IRootDesigner)),
]
public class Wizard : System.ComponentModel.Component, IPageInfoCollection
{
    //...implementation details
}

public class WizardRootDesigner : ComponentDocumentDesigner, IRootDesigner
{
    public override void Initialize( IComponent component )
    {
        base.Initialize(component);

        chgSvc = (IComponentChangeService) GetService(typeof(IComponentChangeService));
        if( chgSvc != null )
            chgSvc.ComponentAdded += new ComponentEventHandler(chgSvc_ComponentAdded);
        else isValid = false;

        desHost = (IDesignerHost) GetService(typeof(IDesignerHost));
        if( desHost != null )
            desHost.LoadComplete += new EventHandler(desHost_LoadComplete);
        else isValid = false;

        if( !isValid )
            MessageBox.Show(null, @"The designer interface could not be established.", "User Alert");
    }

    //...other stuff

    public object GetView(System.ComponentModel.Design.ViewTechnology technology)
    {
        if( theView == null ) theView = new WizardDesignerViewHost();
        return theView;
    }

    public System.ComponentModel.Design.ViewTechnology[] SupportedTechnologies
    {
        get
        {
            return new ViewTechnology[] { ViewTechnology.Default };
        }
    }

    private void desHost_LoadComplete(object sender, EventArgs e)
    {
        isLoading = false;

        // theView isn't initialized by this point under v2/VS2005, but it is under v1.1/VS2003
        theView.ViewControl = new UserControl();
        // ... other stuff
    }
}

The changed behavior between v1.1/VS2003 and v2/VS2005 is that the IDesignerHost.LoadComplete event fires earlier under v2/VS2005.
Specifically, it fires before the calls to IRootDesigner.GetView() and IRootDesigner.SupportedTechnologies are called.

Can someone explain to me why this behavior was changed, and where I can find the documentation for any other related changes? I
didn't see anything in the v2 help file.

- Mark
"Gary Chang[MSFT]" - 17 Apr 2006 09:47 GMT
Hi Mark,

This newsgroup focuses on this issue about the usage of Visual Studio IDE.
So I suggest you consult this problem in more appropriate newsgroups, you'd
get better and quicker help there:

microsoft.public.dotnet.framework.windowsforms.designtime
microsoft.public.dotnet.framework.windowsforms.controls

The reason why we recommend posting appropriately is you will get the most
qualified pool of respondents, and other partners who the newsgroups
regularly can either share their knowledge or learn from your interaction
with us. Thank you for your understanding.

Thanks for your understanding.

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Mark Olbert - 17 Apr 2006 15:41 GMT
Gary,

I'll repost there. But I'd like to point out that GetView() and SupportedTechnologies lie on the interface between VS and the NET
Framework.

- Mark
"Gary Chang[MSFT]" - 18 Apr 2006 03:48 GMT
I appreciate your understanding, Mark.

Good Luck!

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.