开发者

Why does the TreeView control collapse all the children nodes?

开发者 https://www.devze.com 2023-01-06 11:24 出处:网络
When I programmatically collapse a TreeView node like this: treeView1.Nodes[0].Collapse(), all of the children nodes collapse under it, which is really annoying.This doesn\'t happen when you manually

When I programmatically collapse a TreeView node like this: treeView1.Nodes[0].Collapse(), all of the children nodes collapse under it, which is really annoying. This doesn't happen when you manually click on the node to collapse开发者_如何学JAVA it and the children nodes remember their collapsed/expanded state. How do I prevent this from happening?


Use the following method:

public void Collapse(
    bool ignoreChildren
)

ignoreChildren Type: System.Boolean true to leave the child nodes in their current state; false to collapse the child nodes.

See: http://msdn.microsoft.com/en-us/library/ms161262.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消