[英]Configure ListBox in WPF so that I will be possible to select multiple items without holding CTRL key
I have a Listbox that allows user to select multiple items. 我有一个允许用户选择多个项目的列表框。 Normally user can do that by holding CTRL key and clicking the item he or she wants to select. 通常用户可以通过按住CTRL键并单击他或她想要选择的项来完成此操作。
Is it possible to configure this listbox so that the user will not have to hold the CTRL key when selecting items ? 是否可以配置此列表框,以便用户在选择项目时不必按住CTRL键? So that he or she will just click the item (without holding anything) and the item will be selected(diselected if it was selected previously) ? 这样他或她只需点击该项目(不保留任何东西),该项目将被选中(如果之前选择了该项目)?
Thank you 谢谢
Use 使用
SelectionMode="Multiple"
The SelectionMode property determines how many items a user can select at one time. SelectionMode属性确定用户一次可以选择的项目数。 You can set the property to Single (the default), Multiple , or Extended . 您可以将属性设置为Single (默认值), Multiple或Extended 。 The following table described the behavior of these enumeration values. 下表描述了这些枚举值的行为。
Single The user can select only one item at a time. 单个用户一次只能选择一个项目。
Multiple The user can select multiple items without holding down a modifier key. 多个用户可以选择多个项目而无需按住修改键。
Extended The user can select multiple consecutive items while holding down the SHIFT key or non-consecutive items by holding down the CTRL key and clicking the items. 扩展用户可以通过按住CTRL键并单击项目,在按住SHIFT键或非连续项目的同时选择多个连续项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.