2
后,我用这个代码到一个子项添加到BrightIdeasSoftware TreeListView节点:TreeListView编程扩展节点添加子
var br = treeListView1.TreeModel.GetBranch(treeListView1.SelectedObject);
((Node)br.Model).Children.Add(new Node(...));
treeListView1.RefreshObject(br.Model);
然而,当我试着上面的代码后,展开分支:
br.Expand();
我得到以下错误:
Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
与此错误任何帮助吗?
您正在使用什么版本ObjectListView的?如果只有一个孩子,v2.7有时会遇到重建孩子的问题。 – Grammarian
Branch是一个真正的内部类,它只是在这里混淆了你的代码。仅仅使用var node =(Node)treeListView.SelectedObject; – Grammarian
@Grammarian我使用2.8.1。这没有奏效。还有其他建议吗? – Jerry