给定一个 TreeStore 和 TreeIter,如何在不删除父节点的情况下从父节点中删除所有子节点?这些都没有选中,只是想清除父节点下的一组节点。
ParentNode
+- Child 1
+- Child 2
+- Child 3
因此删除“Child 1-3”并保留 ParentNode。
这需要以某种方式循环:
TreePath p = this.game_store.GetPath (this.players_iter);
p.Down ();
TreeIter i = new TreeIter ();
this.game_store.GetIter (out i, p);
this.game_store.Remove (ref i);
最佳答案
试试这个:
while (this.game_store.Remove (ref i));
Documentation of Remove function says :
“@iter 被设置为该级别的下一个有效行,” “如果 @iter 仍然有效,则返回 %TRUE,否则返回 %FALSE。”
关于c# - 如何从 Gtk.TreeStore 中删除父 TreeIter 的所有子节点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39833800/