如何在treelistview中获取所有可见节点 [英] How to get all the visible nodes in treelistview

查看:407
本文介绍了如何在treelistview中获取所有可见节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

学习烹饪& mdash; ObjectListView 2.9.1文档 [ ^ ]



iam使用此控件并希望获得所有可见的模型



我是什么尝试过:



var model = this.BackUpStoragetreeListView.Objects.Cast< storagebackupobjectlist>()。其中​​(x => x.Name.ToLower ()== objAccount.AccountName.ToLower())。FirstOrDefault();



但它只返回一个选定的模型

解决方案



但它只返回一个选定的模型





那是因为: FirstOrD线路末尾的efault()

将其替换为: ToList(),一切都应该没问题。



详情请见:

Enumerable.FirstOrDefault(TSource)Method(IEnumerable(TSource))(System.Linq) [ ^ ]

Enumerable.ToList(TSource)方法(IEnumerable(TSource))(System.Linq) [ ^ ]


Learning to cook &mdash; ObjectListView 2.9.1 documentation[^]

iam using this control and want to get all the models which are visible

What I have tried:

var model = this.BackUpStoragetreeListView.Objects.Cast<storagebackupobjectlist>().Where(x => x.Name.ToLower() == objAccount.AccountName.ToLower()).FirstOrDefault();

but it is returning only one selected model

解决方案


but it is returning only one selected model



That's because of: FirstOrDefault() at the end of line.
Replace it with: ToList() and everything should be OK.

For further details, please see:
Enumerable.FirstOrDefault(TSource) Method (IEnumerable(TSource)) (System.Linq)[^]
Enumerable.ToList(TSource) Method (IEnumerable(TSource)) (System.Linq)[^]


这篇关于如何在treelistview中获取所有可见节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆