Datagrid eats delete key

Mar 9, 2009 at 4:01 PM
I like to do some custom action when the user presses the delete key in the datagrid.

Currently the datagrid just eats  (handles) trhe key even when UserCanDeleteRows is false.

There's also no event Deleting as for all the other commands.

How can I capture the delete onkeydown or executed event?


Mar 9, 2009 at 4:08 PM
Try using the PreviewKeyDown event. This event occurs before the delete execution.

Mar 9, 2009 at 4:50 PM


Works perfectly...

Any Idea how I can have a cell in editing mode when I select it?

So just on click instead of:  click selecting it, click in editing mode….



From: EvanShrub []
Sent: maandag 9 maart 2009 16:08
To: Dave Wils
Subject: Re: Datagrid eats delete key [wpf:49619]

From: EvanShrub

Try using the PreviewKeyDown event. This event occurs before the delete execution.


Read the full discussion online.

To add a post to this discussion, reply to this email (

To start a new discussion for this project, email

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at

Mar 9, 2009 at 7:12 PM
I think this is what you want