I have the following code (a TextBox is focused by default):
TextBox
private void Window_KeyDown(object sender, KeyEventArgs e) { if (Key