Search code examples
.netlistviewwinformscheckedlistbox

Check item in CheckedListBox without selecting


How can I allow the user to click to check an item in CheckedListBox in one click? The default behavior is the first click selects the item, the second click allows you to toggle the check. I don't want to toggle the check on select either, I'm looking for the behavior of the ListView control where I can click directly on check boxes to toggle them without selecting their items first.


Solution

  • The CheckedListBox has a property CheckOnClick.

    CheckOnClick indicates whether the check box should be toggled whenever an item is selected. The default behavior is to change the selection on the first click, and then have the user click again to apply the check mark. In some instances, however, you might prefer have the item checked as soon as it is clicked.

    Read: How do I CheckOnClick in a CheckedListbox but only when over the checkbox?