我无法从树中删除“current_node”的父节点。这是我正在尝试的:我正在为 VSTO 使用 C# .NET 进行开发
TreeGridNode current_node = myTreeGrid.CurrentNode;
TreeGridNode parent_node = myTreeGrid.CurrentNode.Parent;
// this works
myTreeGrid.Nodes.Remove(current_node);
if (parent_node.Nodes.Count == 0) {
// it never gets here, it doesn't detect that the lats child was just removed above
myTreeGrid.Nodes.Remove(parent_node);
}
使用此自定义结构 http://blogs.msdn.com/b/markrideout/archive/2006/01/08/510700.aspx