I have a ListView
on a Form with Checkbox
es enabled. Here's a simple example program:
[STAThread]
static void Main ()
{
var form = new Form();
var listView = new ListView() {
Dock = DockStyle.Fill, CheckBoxes = true, View = View.List };
listView.Items.Add("a");
listView.Items.Add("b");
listView.Items.Add("c");
form.Controls.Add(listView);
Application.Run(form);
}
If you run this program, try drag-selecting two or three ListView
items. This works fine. But now try again and "accidentally" release your mouse button on top of a CheckBox
.
The result is that the CheckBox
below the mouse cursor itself isn't affected, but all the other selected items get checked/unchecked depending on the state of that one CheckBox
. End-users find this behavior erratic, and I agree.
Is there a simple way to suppress such accidental CheckBox
changes when drag-selecting ListView
items?