C#: How would you only draw certain ListView Items while in Virtual Mode?
C#:在虚拟模式下,您如何仅绘制某些ListView项?
I am trying to create a filter-like feature to use in listview so that if the user selects an imageindex from 0-5, it will loop through the listview items and only make it so that the items in question with the correct image index will be displayed and the other items will be hidden. How would I go upon creating such a routine?
我正在尝试创建一个类似于过滤器的功能,以便在listview中使用,这样如果用户从0-5中选择一个imageindex,它将循环遍历listview项目,并且仅使其具有正确图像索引的相关项目显示,其他项目将被隐藏。我将如何创建这样的例程?
1 个解决方案
#1
If you are already using the Virtual Mode for the grid, you know that all items shown in the list are requested from the "RetrieveVirtualItem" event of the list. This means that you should already have an array of objects as the back layer for the list items (the front layer). In order to apply the filter you desire, you just have to maipulate the event handler for the envent above mentioned and using an external variable holding the filter, only return the items that meet the condition.
如果您已经在为网格使用虚拟模式,则您知道列表中显示的所有项都是从列表的“RetrieveVirtualItem”事件中请求的。这意味着您应该已经有一个对象数组作为列表项(前层)的后层。为了应用您想要的过滤器,您只需要为上面提到的事件处理事件处理程序并使用保存过滤器的外部变量,只返回满足条件的项。
Please let me know if you need more details, maybe provide some code for me to specifically help you on,
如果您需要更多详细信息,请告诉我,也许为我提供一些专门帮助您的代码,
#1
If you are already using the Virtual Mode for the grid, you know that all items shown in the list are requested from the "RetrieveVirtualItem" event of the list. This means that you should already have an array of objects as the back layer for the list items (the front layer). In order to apply the filter you desire, you just have to maipulate the event handler for the envent above mentioned and using an external variable holding the filter, only return the items that meet the condition.
如果您已经在为网格使用虚拟模式,则您知道列表中显示的所有项都是从列表的“RetrieveVirtualItem”事件中请求的。这意味着您应该已经有一个对象数组作为列表项(前层)的后层。为了应用您想要的过滤器,您只需要为上面提到的事件处理事件处理程序并使用保存过滤器的外部变量,只返回满足条件的项。
Please let me know if you need more details, maybe provide some code for me to specifically help you on,
如果您需要更多详细信息,请告诉我,也许为我提供一些专门帮助您的代码,