tags:

views:

209

answers:

1

I'm using a windows forms ListView in a C# application and I capture the KeyDown event on it to allow deleting a row using the Delete key. The TreeView class has the TreeNode.IsEditing property if I ever needed it but I couldn't find one in the ListView class. If the user is editing the label of a ListViewItem, I want the Delete key to do the default behavior instead of deleting the item. Is there any built in property I can use? Or do I need to trap both the Before and AfterLabelEdit events?

Edit: Sorry, I had a context menu set with the keyboard shortcut set to the Delete key. This is the event getting called and not the KeyDown event.

A: 

If you are subscribed to KeyDown event on ListView, when you are editing the label of an item the KeyDown event is not hit.

Stan R.
You're absolutely right. I had a context menu shortcut key which was getting called. Is there a way to make that work elegantly?
sleepp
take a look at this question, it should help you. http://stackoverflow.com/questions/358973/delete-in-edit-menu
Stan R.