protected override void OnAfterLabelEdit(LabelEditEventArgs e) { base.OnAfterLabelEdit(e); if (e.Label != null) { string text = e.Label; var item = this.Items[e.Item]; AfterEdit?.Invoke(this, new LabelEditEventArgs(item.Index, text)); } else if (_pressedEsc) { var originalItem = this.Items[e.Item]; var newItem = new ListViewItem(_originalText); newItem.SubItems.Add(originalItem.SubItems[1].Text); this.Items.RemoveAt(e.Item); this.Items.Insert(e.Item, newItem); this.FocusedItem = newItem; foreach (ListViewItem item in this.Items) { item.Selected = false; } newItem.Selected = true; _pressedEsc = false; } _originalText = null; _editItemIndex = -1; }