WPF full screen on maximize

后端 未结 9 1878
醉话见心
醉话见心 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条回答
  •  -上瘾入骨i
    2021-02-04 13:19

    Another solution that worked for me:

    You can set the MaxHeight property of that window to SystemParameters.MaximizedPrimaryScreenHeight using the constructor.

    public MainWindow()
    {
        InitializeComponent();
        this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;
    }
    

    Warning: This might not work on extended desktop.

    Source: Maximize window with WindowState Problem (application will hide windows taskbar)

提交回复
热议问题