C#中:如何有效过滤(隐藏)ListView的项目,而在虚拟模式? [英] C#: How to effectively filter (hide) ListView Items while in virtual mode?
问题描述
C#:如何有效过滤(隐藏)ListView的项目,而在虚拟模式
C#: How to effectively filter (hide) ListView Items while in virtual mode?
我要寻找一种方式来过滤(隐藏/显示)中的ListView项目在虚拟模式。我有我的项目的列表视图项的数组缓存的,我怎么可能有效地使它所以只有特定的ListView项目在pressing一个过滤器按钮,然后所有的人都回来时,pressing一个不过滤显示按钮?
I am looking for a way to filter (hide/show) items in ListView in Virtual Mode. I have my items cached in an array of listview items, how could I effectively make it so only specific listview items are displayed when pressing a filter-button, and then all of them back when pressing a not-filter button?
推荐答案
您需要将您的映射可视行列表,这样,当RetrieveVirtualItem请求一个项目,它要求到您筛选的列表只包含可见项。
You'll need to map your list of visible rows, so that when RetrieveVirtualItem requests an item, it requests into your filtered list that only contains visible items.
如果您使用的是CacheVirtualItems存储ListViewItems,你需要更新缓存时,应用过滤,删除所有不可见的行。你可能只想清除在该点的缓存来降低复杂性。
If you're using CacheVirtualItems to store ListViewItems, you'll need to update that cache when the filtering is applied, removing all non-visible rows. You may want to just clear the cache at that point to reduce complexity.
这篇关于C#中:如何有效过滤(隐藏)ListView的项目,而在虚拟模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!