How do I make a listview not automatically check an item when I double click it?
I can try hooking into the MouseDoubleClick event, and set the Checked property to false
If you don't want to turn of the DoubleClick messages completely, but just turn off the autocheck behaviour. You can instead do the following:
public class NoDoubleClickAutoCheckListview : ListView
{
private bool checkFromDoubleClick = false;
protected override void OnItemCheck(ItemCheckEventArgs ice)
{
if (this.checkFromDoubleClick)
{
ice.NewValue = ice.CurrentValue;
this.checkFromDoubleClick = false;
}
else
base.OnItemCheck(ice);
}
protected override void OnMouseDown(MouseEventArgs e)
{
// Is this a double-click?
if ((e.Button == MouseButtons.Left) && (e.Clicks > 1)) {
this.checkFromDoubleClick = true;
}
base.OnMouseDown(e);
}
protected override void OnKeyDown(KeyEventArgs e)
{
this.checkFromDoubleClick = false;
base.OnKeyDown(e);
}
}