문제

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 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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top