tags:

views:

64

answers:

1

In my projects (WPF) I use System.Windows.MessageBox to show the user a confirmation dialog for operations that are critical, such as a delete-operation.

My problem is that if I specify as button value MessageBoxButton.YesNo, the user cannot use the escape-key to cancel the operation. IMO this is one of the most annoying things, a program can do, showing a dialog without the possibility to cancel/close the dialog through the escape-key.

Other possibilities are MessageBoxButton.YesNoCancel, but IMO this is confusing because it shows three buttons for only two operations . Or one can use MessageBox.OKCancel, but this is IMO not clear enough. In my dialogs I want to ask the user if her really wants to execute the operation. And for this, a simple ok is not appropriate. A yes (I want) is much better than an ok (go on).

How do you handle this? Is it a non-topic or do you think as I do and have an own MessageBox-implementation or do you know a possibility to extend the System.Windows.MessageBox-class?

+1  A: 

Make a custom message box (inheriting from Window) that has placeholders for header/message and confirmation button text. Then you can design a nice, attention-grabbing dialog that will stand out from the hundreds of standard OK/Cancel MessageBoxes a user typically sees. For example, you can use a larger header font similar to the Windows Vista dialogs, or include a custom image.

Then, you could obviously handle the Escape key yourself, and define the default Escape behavior on a per-dialog basis.

Charlie