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
On button click event handler, we add the content of TextBox to the ListBox by using the ListBox. Items. Add method. Now if you enter text in the TextBox and click Add Item button, it will add contents of the TextBox to the ListBox.
ListBox is a control that provides a list of items to the user item selection. A user can select one or more items from the predefined list of items at a time. In a ListBox, multiple options are always visible to the user without any user interaction.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With