Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6851973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:18:52+00:00 2026-05-27T01:18:52+00:00

I have a user control, which contains both a Panel and a TabControl. I

  • 0

I have a user control, which contains both a Panel and a TabControl. I enabled design-time support for both. I can drag/drop controls from the toolbox onto the Panel control that resides within the user control. I can also add and remove tab pages via the designer on the TabControl. However, I am not able to drag/drop any controls onto the tab pages themselves.

Below is the code generated source code for my user control:

partial class TestUserControl
{
    private System.ComponentModel.IContainer components = null;

    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Component Designer generated code

    private void InitializeComponent()
    {
        this.tabControl = new System.Windows.Forms.TabControl();
        this.contentPanel = new System.Windows.Forms.Panel();
        this.SuspendLayout();
        // 
        // tabControl
        // 
        this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
        this.tabControl.Location = new System.Drawing.Point(0, 0);
        this.tabControl.Name = "tabControl";
        this.tabControl.SelectedIndex = 0;
        this.tabControl.Size = new System.Drawing.Size(306, 118);
        this.tabControl.TabIndex = 0;
        // 
        // contentPanel
        // 
        this.contentPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
        this.contentPanel.Location = new System.Drawing.Point(0, 118);
        this.contentPanel.Name = "contentPanel";
        this.contentPanel.Size = new System.Drawing.Size(306, 73);
        this.contentPanel.TabIndex = 0;
        // 
        // TestUserControl
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.Controls.Add(this.tabControl);
        this.Controls.Add(this.contentPanel);
        this.Name = "TestUserControl";
        this.Size = new System.Drawing.Size(306, 191);
        this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.TabControl tabControl;
    private System.Windows.Forms.Panel contentPanel;
}

Below is the source code I added to enable design-time support:

[Designer(typeof(TestUserControlDesigner))]
public partial class TestUserControl : UserControl
{
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
    public TabControl TabControl 
    {
        get { return this.tabControl; }
    }

    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
    public Panel ContentPanel
    {
        get { return this.contentPanel; }
    }

    public TestUserControl()
    {
        InitializeComponent();
    }
}

internal class TestUserControlDesigner : ParentControlDesigner
{
    public override void Initialize(System.ComponentModel.IComponent component)
    {
        base.Initialize(component);

        EnableDesignMode(
            (this.Control as TestUserControl).TabControl, "TabControl");
        EnableDesignMode(
            (this.Control as TestUserControl).ContentPanel, "ContentPanel");
    }
}

What do I need to do, so that I can drag/drop controls onto the tab pages of the TabControl?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:18:52+00:00Added an answer on May 27, 2026 at 1:18 am

    You have to enable design mode on the existing tab pages as well:

    internal class TestUserControlDesigner : ParentControlDesigner {
        public override void Initialize(System.ComponentModel.IComponent component) {
            base.Initialize(component);
            var ctl = (this.Control as TestUserControl).TabControl as TabControl;
            EnableDesignMode(ctl, "TabControl");
            foreach (TabPage page in ctl.TabPages) EnableDesignMode(page, page.Name);
            EnableDesignMode((this.Control as TestUserControl).ContentPanel, "ContentPanel");
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user control in silverlight which contains both XMAL and .cs file.
I have two controls which are both contained within a user control. Panel location:
I have a nested user control which appears on every single page. It contains
I have a user control, GridMasterControl which contains (amongst other things) another control called
I am using a WPF c# application. I have a user control which contains
In my main window, I have a child control(user control) which contains a text
I have a user control which contains a textbox. I have a class called
I have user control on a ASP.NET web page, which contains a GridView and
I have a user control which contains a CustomValidator which is used according to
I have a user control which contains some buttons and a placeholder. Those buttons

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.