简体   繁体   中英

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.

Is it possible to configure this listbox so that the user will not have to hold the CTRL key when selecting items ? 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"

From the MSDN :

The SelectionMode property determines how many items a user can select at one time. You can set the property to Single (the default), Multiple , or 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM