I have a KeyDown
event handler (created by Visual Studio) for my dialog to close the window:
private void Window_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
this.DialogResult = false;
this.Close();
}
}
When I'm in the program and press the Escape
key, the dialog goes to the back of the main screen instead of closing it. I put a break point in at the function, and it never hits.
Has this happened to anyone before? Does anyone know of a solution?