Some ideas come to mind:
The second easiest:
You save the selection in the SelectionChanged Event and in the Mouse events
you check if there is a selection or not. If not then you "restore" the
previously saved selection...
The hardest:
You subclass the Listview to intercept the Windows messages to the control.
When a mousedown event is fired, you check the mouse coordinates to see if
there is an item under the cursor. If not, you don't pass on the message to
the control.
The wackiest:
You calculate how much of the Listview that is NOT occupied by items:
ListView Height - (Header Height + Item Count * Item Height) and then you
position a label or a textbox - with no border and same backcolor as the
Listview - over that area. That way, the dummy control gets the mouse
events - not the listbox. Don't forget to take into consideration the height
of a horizontal scrollbar if one is present...
And by far the easiest:
You allow no selection but tell your user when he/she tries to leave the
form that a selection has to be made. You cancel the form close and return
focus to the listview
In my opinion, the deselection of items when you click on the non-item area
ought to be up to the programmer by setting a property, but as usual,
Microsoft is not making it easy for us...
Cheers and good luck,
Johnny J.