title: Display xml tags and values in treeview winforms
body: <p>I'm trying to display xml data using this answer: <a href="https://stackoverflow.com/a/5438168/5859562">https://stackoverflow.com/a/5438168/5859562</a>
  but the problem is that the query only selects only tag names and I want values aswell. The query is as follows:</p>
  
  <pre><code>element.HasElements ?
      node.AddRange(from item in element.Elements()
      let tree = new TreeNode(item.Name.LocalName)
      from newNode in GetNodes(tree, item)
      select newNode)
      : new[] { node };
  </code></pre>
  
  <p>So far I managed to come up with something that's almost working, I added </p>
  
  <pre><code>let tree = item.HasElements ? new TreeNode(item.Name.LocalName) :
          new TreeNode(item.Value)
  </code></pre>
  
  <p>so now if it's the "most inner" tag it shows the value (the perfect solution will show the tag name and then the value).</p>
  
  <p>Say for this xml I'd like the data to be displayed like this:</p>
  
  <pre><code>&lt;StepList&gt;
    &lt;Step1&gt;
      &lt;Name&gt;name1&lt;/Name&gt;
      &lt;Empty&gt;void1&lt;/Empty&gt;
    &lt;/Step1&gt;
    &lt;Step2&gt;
      &lt;Name&gt;Name2&lt;/Name&gt;
      &lt;Empty&gt;void2&lt;/Empty&gt;
    &lt;/Step2&gt;
  &lt;/StepList&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/eb2JF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eb2JF.png" alt="Example picture"></a></p>