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 8936003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:07:02+00:00 2026-06-15T10:07:02+00:00

I have a process which uses recursion to generate controls from XML. The system

  • 0

I have a process which uses recursion to generate controls from XML. The system is complicated. I’ve broken down as small as I can. The last Plugin is visible, the rest are not. I suspect GenerateControls() is broken. Why don’t all the plugins display?

Form:

public partial class PdLoadingForm : Form
{        
    public PdLoadingForm()
    {
        InitializeComponent();

        PhysDocDocument document = MockDocument();//Generate some mock data
        GenerateControls(document.Nodes);//Generate controls using recursion.
    }

    private PhysDocDocument MockDocument()
    {
        PhysDocDocument document = new PhysDocDocument();
        PhysDocNode outerNode = new PhysDocNode();
        outerNode.Display = "outer Node";

        //Generate 3 plugins.  Each plugin generates a textbox.  I only see 1 Textbox.
        //I expect to see 3 textboxes.
        for(int i = 0; i < 3; i++)
        {
            PhysDocNode innerNode = new PhysDocNode() { Display = "test" + i };

            PhysDocNode innerNodeContent = new PhysDocNode() { Display = "IO" };
            innerNodeContent.Plugins.Add(new Plugin());

            innerNode.Nodes.Add(innerNodeContent);
            outerNode.Nodes.Add(innerNode);
        }

        document.Nodes.Add(outerNode);

        return document;

    }

    private void GenerateControls(List<PhysDocNode> children, CustomControl parent = null)
    {
        foreach (PhysDocNode node in children)
        {
            CustomControl parentControl = new CustomControl(node);                

            if (node.Nodes != null && node.Nodes.Count > 0)
                GenerateControls(children: node.Nodes, parent: parentControl);

            foreach (Plugin plugin in node.Plugins)
            {  
                Control childControl = plugin.CreateUIControl();//Ask the plugin for a control
                AddControl(childControl: childControl, parent: parentControl);
            }

            AddControl(childControl: parentControl, parent: parent);
        }
    }

    private void AddControl(Control childControl, Control parent)
    {
        childControl.Dock = DockStyle.Top;

        if(parent == null)//add to form
            Controls.Add(childControl);
        else//add to parent
            parent.Controls.Add(childControl);
    }
}

Plugin:

public class Plugin
{
    [XmlAttribute]
    public string type { get; set; }

    public Control CreateUIControl()
    {
        TextBox testBox = new TextBox();
        testBox.Text = "plugin";

        return testBox;
    }
}

CustomControl:

public class CustomControl: UserControl
{    
    public CustomControl(PhysDocNode nodeInfo)
    {
        InitializeComponent();
        Label label = new Label();
        label.Text = "Rtb..." + nodeInfo.Display;
        label.Dock = DockStyle.Top;
        contentPanel.Controls.Add(label);//just drop a panel on the user control in design view
    }
  • 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-06-15T10:07:03+00:00Added an answer on June 15, 2026 at 10:07 am

    Looking at the documentation, it seems that the Dock property manage the positionning of the label relatively to its parent.

    You may try to specify the label position by, for example, setting its Top property‘s value to a multiple of its index in your control list.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a process x which uses system C function to start ntpd daemon.
I have been working on a small Plagiarism detection engine which uses Idea from
I have a C# app which uses a System.Diagnostics.Process to run another exe. I
Windows Mobile 6.5 I have a process which uses System.Threading.Timer upload some data to
I have a maven project which uses wsgen to generate XSD files from the
I have one basic doubt. I have a process which uses a shared library.
I have an app which uses btouch'd bindings for WEPopover. You can find the
We have a worker role in Azure which uses Process.Start to kick off a
We have a process updating the database which uses the following SQL IF NOT
Here is the scenario: I have a java main process, which uses JMS to

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.