Disable maximize button of WPF window, keeping resizing feature intact

后端 未结 6 1591
遇见更好的自我
遇见更好的自我 2021-01-31 02:13

So WPF windows only have four resize mode options: NoResize, CanMinimize, CanResize and CanResizeWithGrip. Unfortunately, the

6条回答
  •  忘掉有多难
    2021-01-31 02:54

    Another option is catching the StateChanged event which is raised when the window is maximized. Then simply set the WindowState to "Normal".

    This however does not hide the maximize box!

    private void Window_StateChanged(object sender, EventArgs e)
    {
        if (WindowState == WindowState.Maximized)
        {
            WindowState = WindowState.Normal;
        }
    }
    

提交回复
热议问题