I have done some digging and found some code that can run the application directly to full-screen mode during runtime, I was wondering if there is any way to switch back to windowed mode by pressing “Esc” ?
Here is my code for full-screen mode:
private void Window_Loaded(object sender, RoutedEventArgs e) {
WindowStyle = WindowStyle.None;
Topmost = true;
WindowState = WindowState.Maximized;
}
Set
this.KeyPreview = true;And
this.KeyDown += new System.Windows.Forms.KeyEventHandler(Form_KeyDown);