How to create a dialog window or something similar to confirm a delete action before deleting a datagrid row?
Asked
Active
Viewed 1,675 times
1 Answers
2
In WPF there are "preview" events that get called before the "standard" event gets called. These events have the word Preview prefixed on the event name (i.e. PreviewMouseDown). In the "preview" event you can display a MessageBox, or something similar, asking the user to confirm the deletion. If the user confirms the deletion let the event continue. Otherwise you can mark the event as handled and the "standard" event will not execute.

Phillip
- 94
- 4
-
-
1Sure. I'll put together a little example and post it here. Until then visit [WPF Tutorial.net](http://www.wpftutorial.net). It has some great info especially for newbies. – Phillip Nov 18 '15 at 21:31
-
1So, there was too many characters to add the code samples here, so I put them on my blog. My blog is at [http://killerbytz.blogspot.com/2015/11/routed-events-example.html](http://killerbytz.blogspot.com/2015/11/routed-events-example.html) – Phillip Nov 19 '15 at 02:01