views:

77

answers:

1

I m working on windows project with c#. I want to close collapse property of treeview when i m double clicking on the nodes.

A: 

Your question is a little unclear, but do you want to collapse treeview nodes when double clicking on them? If som the following snippet might be of use (assume "tv" is the treeview in question)

tv.NodeMouseDoubleClick += delegate(object sender, TreeNodeMouseClickEventArgs e)
{
    if (e.Node.IsExpanded)
        e.Node.Collapse();
    else
        e.Node.Expand();
};

This collapses the tree node on double click if it is expanded, and expands it if it was collapsed.

John Källén