title: Can't expand nodes in TreeView (WinForms)
body: <p>I'm filling <code>TreeView</code> programmatically (in different thread if it matters).</p>
  
  <p>I want the first level of nodes to be expanded when <code>TreeView</code> loads to window. I've tried almost everywhere (in worker thread, in main thread, in event handlers of <code>Form.Load</code>, <code>Form.Shown</code> etc.), but <code>TreeView</code> is still collapsed.</p>
  
  <p>What am I doing wrong ?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <pre><code>treeView.UpdateTree((object tree) =&gt; {
      treeView.Nodes[0].Nodes.Add(text);
  });
  
  public static void UpdateTree(this Control ctrl, Action&lt;object&gt; code) {
      if (ctrl.InvokeRequired) {
          ctrl.BeginInvoke(code, (TreeView)ctrl);
      }
      else {
          code.Invoke((TreeView)ctrl);
      }
  }
  </code></pre>
  
  <p><strong>UPDATE 2</strong></p>
  
  <pre><code>private void btnFillTree_Click(object sender, EventArgs e) {
      ......
      treeDirectoryContents.Nodes.Add("GeneralFolder");
      ......
      //there I create Thread() that fills treeDirectoryContents
      ......
      treeDirectoryContents.ExpandAll();
  }
  </code></pre>