I got a code snippet like this that keeps one parent node expanded:

protected void TreeView1_TreeNodeExpanded(object sender,
TreeNodeEventArgs e)
{
    string currValue = e.Node.Value.Trim();

    foreach (TreeNode tnode in TreeView1.Nodes)
    {
        if (tnode.Value != currValue)
        {
            tnode.Collapse();
        }
    }
}


I attempted to translate this on a Winforms TreeView, but it didn't
work for me. Note that
there is no TreeNodeExpanded() event available under Winforms. So I
had to put my translated code under the NodeMouseClick() event. It's
the closest that I could find that matches the code above. Any
recommendations?


Reply via email to