WPF full screen on maximize

后端 未结 9 1876
醉话见心
醉话见心 2021-02-04 12:56

I basically want to have my WPF window to go in full screen mode, when F11 is pressed or the maximize button in the right top corner of the window is pressed.

While the

9条回答
  •  感情败类
    2021-02-04 13:19

    In my case, minimizing and maximizing will make the fullscreen size to be a little bit bigger than the screen, so the alternative I found is to temporarily set the Visibility to Collapsed then back to Visible afterwards to force redraw.

    Visibility = Visibility.Collapsed;
    WindowStyle = WindowStyle.None;
    WindowState = WindowState.Maximized;
    ResizeMode = ResizeMode.NoResize;
    Visibility = Visibility.Visible;
    

提交回复
热议问题