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

问题描述

[]



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



我是什么尝试过:



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



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

解决方案





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

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



详情请见:

[]

[ ]

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

解决方案



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中获取所有可见节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 21:07