TreeListView 在添加子项后以编程方式展开节点
TreeListView programmatically expand node after adding child
我使用此代码将子节点添加到 BrightIdeasSoftware 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.
对这个错误有什么帮助吗?
这对我有用:
treeListView1.Expand(br.Model);
我使用此代码将子节点添加到 BrightIdeasSoftware 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.
对这个错误有什么帮助吗?
这对我有用:
treeListView1.Expand(br.Model);