Normally you cannot deselect all items in a ListBox once you have selected one. This example shows one way to let the user deselect all items.
When you click on an item, you see these events:
When you click off the items, you see these events:
The trick is to determine whether you received a Click event.
In the Click event handler, set a Boolean variable indicating that a Click occurred. Then in the MouseUp event, see if it follows a Click.
|