且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Listview子项重复

更新时间:2023-11-29 17:14:22

如果您通过手动添加listitems创建列表视图,那么显然如何有选择地删除listitems。



但是,正如@Sergey Alexandrovich Kryukov指出的那样:

为什么不首先避免重复。



您可以根据字段值修改查询以包含行或排除它们。然后将生成的对象传递给listview,无需再进一步修改listview。



您还可以查看listview类以查看可用的方法以编程方式删除listitem或引用它们。
If you're creating a listview by manually adding the listitems, then it's obvious how to selectively remove listitems.

But, as @Sergey Alexandrovich Kryukov points out:
why not avoid duplicates in the first place.

You can modify your query to include rows or exclude them, based on field values. Then pass the resulting object to the listview, eliminating the need to modify the listview any further.

You can also look at the listview class to see what methods are available for deleting a listitem programmatically or referencing them.