private void DeviceList_MouseDown(object sender, MouseEventArgs e) { var item = DeviceList.GetItemAt(e.X, e.Y); if (item == null) { DeviceList.ContextMenu = null; DeviceList.SelectedObjects.Clear(); } }