gpt4 book ai didi

c# - TreeListView 在添加子项后以编程方式展开节点

转载 作者:太空宇宙 更新时间:2023-11-03 13:07:24 24 4
gpt4 key购买 nike

我使用此代码将子级添加到 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);

关于c# - TreeListView 在添加子项后以编程方式展开节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30304746/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com