Whenever the Enter key is pressed while in a Modal Window, the Modal Window closes. Therefore, it will not execute any custom code that an OK button is meant to run. At the same time, there may be a need to prevent this window from closing, i.e. when conditions do not meet the OK button's _CanExecute() method.There seems to be a a way to catch the window Closing event, but there is no way to prevent the modal window from closing. Setting the CancelEventArgs.Cancel = True as mentioned in the link below does not stop the window from closing.http://msdn.microsoft.com/en-us/library/system.componentmodel.canceleventargs.cancel(v=VS.95).aspx
Please wait...