I don't understand MenuItem.Shortcut

T

Terry

I have a context menu for a ListView in Detail view. The items are
editable. I would like the user to be able to press the "Del" key to remove
items and have a context menu item for the delete function as well. So, I
created a MenuItem and set the "Shortcut" property to "Del".

At this point the user can hit the "Del" button and the items are deleted,
or the user can right-click and select the "Delete items" menu item and the
items are deleted. So far, so good.

The problem is when the user is *editing* an item and then hits the "Del"
key in the edit box to remove characters. I'd expect the edit control to
handle the delete and just remove the character in front of the cursor, but
instead, the MenuItem's delete handler gets fired and removes the item from
the view.

This seems like incorrect behavior to me. If the edit control has focus,
all keystrokes should be handled by the edit box.

How does everyone else deal with this? Just not set MenuItem shortcuts?

Thanks,
Terry
 
S

Sijin Joseph

Imagine if you had a save context menu item with a shortcut of say Ctrl-S
wouldn't you want a user who is editing to be able to press Ctrl-S to save
the data? or would you rather prefer that only edit functions be available
until he leaves edit mode?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top