列表框中选择所有项目 [英] ListBox select all items

查看:104
本文介绍了列表框中选择所有项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在列表框中选择所有项目被点击一个复选框时。是否有可能使用一个单一的代码行来选择ListBox中的所有项目? ?还是将我必须通过所有项目,并设置循环选择真正为他们的每一个

I need to select all items in a ListBox when a CheckBox is clicked. Is it possible to select all items in the ListBox using a single line of code? Or will I have to loop through all items and set selected to true for each one of them?

感谢:)

推荐答案

我认为你必须循环在这里。一次选择的所有项目是一个非常具体的(也可能是罕见的)使用情况下是完全没有意义的提供这种功能的开箱即用。此外,循环将只是两行代码反正。

I think you have to loop here. Selecting all items at once is a pretty specific (and probably rare) use case where it simply makes no sense to offer that functionality out of the box. Furthermore, the loop will be just two lines of code anyway.

这篇关于列表框中选择所有项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆