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

  • Home
  • SEARCH
  • 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 6208137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:45:21+00:00 2026-05-24T05:45:21+00:00

To start off, I have this XML file that contains recursive parent-child elements. Here

  • 0

To start off, I have this XML file that contains recursive parent-child elements. Here is how the XML looks:

   <VARS>
    <VAR>
      <id>var_starting_point</id>
      <name>Starting Point</name>
      <values>
        <value>
          <id>http://Environment1URL.com</id>
          <name>Enviornment 1</name>
          <sub_vars>
            <VAR>
              <id>var_env1_data</id>
              <name>Env1 Data</name>
              <values>
                <value>
                  <name>Data1</name>
                  <sub_var>
                    <VAR>
                      <id>var_db</id>
                      <name>DB</name>
                      <values>
                        <values>place-holder 1</values>
                      </values>
                    </VAR>
                  </sub_var>
                </value>
                <value>
                  <name>Data2</name>
                  <sub_var>
                    <VAR>
                      <id>var_db</id>
                      <name>DB</name>
                      <values>
                        <values>place-holder 2</values>
                      </values>
                    </VAR>
                  </sub_var>
                </value>
              </values>
            </VAR>
          </sub_vars>
        </value>
        <value>
          <id>http://Environment2URL.com</id>
          <name>Enviornment 2</name>
          <sub_vars>
            <VAR>
              <id>var_env2_data</id>
              <name>Env2 Data</name>
              <values>
                <value>
                  <name>Data1</name>
                  <sub_var>
                    <VAR>
                      <id>var_db</id>
                      <name>DB</name>
                      <values>
                        <values>place-holder 1</values>
                      </values>
                    </VAR>
                  </sub_var>
                </value>
                <value>
                  <name>Data2</name>
                  <sub_var>
                    <VAR>
                      <id>var_db</id>
                      <name>DB</name>
                      <values>
                        <values>place-holder 2</values>
                      </values>
                    </VAR>
                  </sub_var>
                </value>
              </values>
            </VAR>
          </sub_vars>
        </value>
      </values>
    </VAR>
    <VAR>
      <id>var_version_data1</id>
      <name>Data1 Version</name>
      <values>
        <value>
          <name>1.1.1</name>
        </value>
      </values>
    </VAR>
    <VAR>
      <id>var_version_data2</id>
      <name>Data2 Version</name>
      <values>
        <value>
          <name>2.2.2</name>
        </value>
      </values>
    </VAR>
  </VARS>

I have a VARS element which contain 1 or more VAR element which has an id, name and
values array which contain 1 or more value elements.
The sub_var and id elements of the value element is optional, the name
element is not. The sub_var contains the exact same stuff as VARS
and so on.

Now I want to generate child combo boxes based on what was choosen in the
parent comboBox.
For example, if the user chooses “Enviornment 1” from the
Starting Point comboBox, than an Env1 Data combo box should spawn with
the Env1 values. Then if the user chooses “Data1”, then the DB combo box
should be populated with “place-holder 1”.

I’ve been working on this for hours and I’m not getting anywhere. I was able to get
1 layer working non recursivley, however multiple nested elements have been giving me a headache.
The way I do it now is, save the selected item to a temp variable, then on my selection changed event handler I clear my stack panel and recreate all the combo boxes based on what was selected last. However this does not seem to be working properly with multiple nested elements.

I’m just looking for ideas and how you would approach this problem.

  • 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-24T05:45:23+00:00Added an answer on May 24, 2026 at 5:45 am

    First, I would deserialize your structure into a class that looked like this:

    class XmlVar
    {
        public List<XmlVar> Children { get; set; }
        public string ID { get; set; }
        public string Name { get; set; }
    }
    

    Once you did this, you can add a method to XmlVar to create your ComboBox for that node. Something like this:

    public ComboBox MakeNodeCombo()
    {
        ComboBox retval = new ComboBox();
        if (Children != null)
        {
            foreach (XmlVar child in Children)
            {
                ComboBoxItem nextItem = new ComboBoxItem;
                nextItem.Content = Name;
                nextItem.Tag = child;      // So we have an easy time choosing the child
                retval.Add(nextItem);
            }
        }
        return retval;
    }
    

    When you get a SelectedItem event, get the corresponding ComboBoxItem. It’s Content is the Name, and its Tag is the child XmlVar node that you now want to target.

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

Sidebar

Related Questions

The basic problem I have here is that I have one xml file that
I have an XML file that I want to transform using an XSLT. It
Let me start off by saying that I am completely new with WPF (this
Let me start this off by saying that I'm an intern with no Powershell
I have a code as such that reads in an xml file into a
So I have a TreeView that starts off empty. Sequence of events is as
I have a UIImageView that starts off with an image (loading.png) specified in IB.
Let me start off with a bit of background. This morning one of our
First off, let me start off that I am not a .net developer. The
I'm trying to create a bookmarklet that will start off an AJAX call 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.