title: One checked node at a time in TreeView
body: <p>I have a <code>TreeView</code> populated from database with lots of node, and each node may have some children and there is no fixed role like 2 depthes, it may be very deep.  </p>
  
  <p>Imagine that the <code>TreeView</code> <code>CheckBoxes</code> are <code>RadioButtons</code>, I want my <code>TreeView</code> just to have one checked node at a time. I have tried <code>AfterCheck</code> and <code>BeforeCheck</code> events but they fall into forever loop, what can I do?</p>
  
  <p>I want to keep my checked node CHECKED and uncheck all other nodes but I can't. Waiting for your smart points. Thanks.</p>
  
  <p>Here's the code I have tried but ended up with a <code>StackOverFlow</code> exception, and I thought maybe it's saying go and check it on <a href="http://www.stackoverflow.com">StackOverflow</a> :D</p>
  
  <pre><code>private void tvDepartments_AfterCheck(object sender, TreeViewEventArgs) 
  {
     List&lt;TreeNode&gt; nodes = new List&lt;TreeNode&gt;();
     if (rdSubDepartments.Checked)
         CheckSubNodes(e.Node, e.Node.Checked);
     else if (rdSingleDepartment.Checked)
     {
         foreach (TreeNode node in tvDepartments.Nodes)
         {
             if (node != e.Node)
                 node.Checked = false;
         }
     }
  }
  
  
  public void CheckSubNodes(TreeNode root, bool checkState)
  {
      foreach (TreeNode node in root.Nodes)
      {
          node.Checked = checkState;
          if (node.Nodes.Count &gt; 0)
              CheckSubNodes(node, checkState);
      }
  }
  </code></pre>