通过虚拟模式在ListView的所有元素循环 [英] Loop through all elements in a ListView in virtual mode
问题描述
我有一个创建一个从列表视图的PDF报告报告模块。
I have a reporting module which creates PDF reports from ListViews.
现在,我在虚拟模式的ListView,所以我不能遍历所有的项目集合。
Now, I have a ListView in Virtual mode and therefore I cannot loop over the Items collection.
我如何遍历从报告模块列表视图中的所有元素?
How do I loop over all elements in the list view from the reporting module?
我可以得到 VirtualListSize
属性,所以我知道有多少元素有在列表中。
我可以以某种方式调用 RetreiveVirtualItem
明确?
I can get the VirtualListSize
property, so I know how many elements there are in the list.
Could I somehow call the RetreiveVirtualItem
explicitly?
报表模块没有关于在ListView垫层名单知识。
The Reporting module has no knowledge about the underlaying list in the ListView.
推荐答案
在一个虚拟的ListView,你不能重复的项目
,但你仍然可以通过它们的索引来访问它们
In a virtual ListView, you cannot iterate the Items
, but you can still access them by their index:
for (int i = 0; i < theVirtualListView.VirtualListSize; i++) {
this.DoSomething(theVirtualListView.Items[i]);
}
这篇关于通过虚拟模式在ListView的所有元素循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!