© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•9mo ago•
15 replies
stigzler

✅ ParentControlDesigner not creating Verbs on UserControl/Winforms

Not sure what's wrong with the below. It's meant to create two verbs (i.e. links/controls in the propertyGrid in VS2022) on the custom control "Wizard" - however, these are not showing up. Code:
internal class WizardDesigner : ParentControlDesigner
{

    public override void Initialize(System.ComponentModel.IComponent component)
    {
        base.Initialize(component);
    }

    DesignerVerbCollection fVerbs;
    public override DesignerVerbCollection Verbs
    {
        get
        {
            if (fVerbs == null)
                fVerbs = new DesignerVerbCollection(new DesignerVerb[]
                    {
                        new DesignerVerb("Add Wizard Page", OnAdd) ,
                        new DesignerVerb("Remove Selected Page", OnRemove),
                    }
                );
            return fVerbs;
        }
    }

    void OnAdd(object sender, EventArgs e)
    {
        var wizard = ((Wizard)this.Control);
        wizard.AddNewWizardPage();
    }

    void OnRemove(object sender, EventArgs e)
    {
        var wizard = ((Wizard)this.Control);
        wizard.RemoveSelectedWizardPage();
    }
}

[Designer(typeof(WizardDesigner))]
public partial class Wizard : BaseUserControl
{
    // blah...
}
internal class WizardDesigner : ParentControlDesigner
{

    public override void Initialize(System.ComponentModel.IComponent component)
    {
        base.Initialize(component);
    }

    DesignerVerbCollection fVerbs;
    public override DesignerVerbCollection Verbs
    {
        get
        {
            if (fVerbs == null)
                fVerbs = new DesignerVerbCollection(new DesignerVerb[]
                    {
                        new DesignerVerb("Add Wizard Page", OnAdd) ,
                        new DesignerVerb("Remove Selected Page", OnRemove),
                    }
                );
            return fVerbs;
        }
    }

    void OnAdd(object sender, EventArgs e)
    {
        var wizard = ((Wizard)this.Control);
        wizard.AddNewWizardPage();
    }

    void OnRemove(object sender, EventArgs e)
    {
        var wizard = ((Wizard)this.Control);
        wizard.RemoveSelectedWizardPage();
    }
}

[Designer(typeof(WizardDesigner))]
public partial class Wizard : BaseUserControl
{
    // blah...
}

There's nothing in
BaseUserControl
BaseUserControl
that will be confounding it - any ideas?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

winforms clr/c++ usercontrol issue
C#CC# / help
3y ago
Transparent Background UserControl/Custom DoubleBufferedPanel in WinForms causing tearing issues
C#CC# / help
2y ago
❔ DataContext & UserControl
C#CC# / help
3y ago
UserControl problem
C#CC# / help
3y ago