microsoft/winforms-designer-extensibility

Various issues while implementing IRootDesigner

Closed this issue · 4 comments

Hello,

Im trying to implement a simple IRootDesigner, using latest version of SDK 1.9.0-preview.3.24054.5
But i'm getting the following error in VS ( Version 17.10.0 Preview 1.0):

"WINFRMSDK001 Type "Test" does not return a valid view type from GetView."

Heres the code IRootDesigner implementation:

public partial class TestObjDesigner : ComponentDesigner, IRootDesigner
{
private TestView temp = new TestView();

public ViewTechnology[] SupportedTechnologies
{
    get { return new[] { ViewTechnology.Default }; }
}
public override void Initialize(IComponent component)
{
    base.Initialize(component);
}
public TestObjDesigner()
{
    InitializeComponent();
}

public object GetView(ViewTechnology technology)
{
    return new TestView();
}

}

And the view:

public partial class TestView : : Microsoft.DotNet.DesignTools.Designers.DesignerScrollableControl
{
    public TestView() base(root) { InitializeComponent(); }

}

Could you please clarify what is a valid view type?
If theres any documentation available on this topic please provide a link.

cc @KlausLoeffelmann

Thanks,
Tim

I have managed to resolve the above issue by adding the following method to IRootDesigner implementation:
public Microsoft.DotNet.DesignTools.Designers.DesignerScrollableControl GetView(ViewTechnology technology)
{
return TestView(this);
}

But now im getting a error at opening designer:

image

Full log:
Log.txt

Seems like something is missing

@KlausLoeffelmann Could you please provide few tips on how to implement a simple IRootDesigner? Or if you happen to have a sample project that would be ideal.

Thanks

Tim

I am in the process of preparing a root designer sample and the introductionary docs. But I am also involved in a series of additional high-priority tasks, so, bear with me a bit longer, and let me try to help you out iteratively:

Basically, using the DesignerScrollableControl is the correct approach. But also note, that you need to set up the same infrastructure which you would need for supporting custom Type Editor scenarios for the Out-Of-Proc Designer. So, you can principally adapt the custom Type-Editor templates from the templates folder, and then if you check that they work, adapt them for the root designer scenarios.

Thank you for your reply.
Looking forward to root designer samples and documentation, meanwhile i will try adapting templates as you have suggested.

Closed since i managed to get basic RootDesigner working using existing samples