How do I remove minimize and maximize from a resizable window in WPF?

后端 未结 7 1170
我寻月下人不归
我寻月下人不归 2020-12-04 12:05

WPF doesn\'t provide the ability to have a window that allows resize but doesn\'t have maximize or minimize buttons. I\'d like to able to make such a window so I can have re

7条回答
  •  天命终不由人
    2020-12-04 12:21

    Here's a solution I'm using. Note that maximize button is still displayed.

    Markup:

    
    

    Code behind:

    // Disable maximizing this window
    private void Window_StateChanged(object sender, EventArgs e)
    {
        if (this.WindowState == WindowState.Maximized)
            this.WindowState = WindowState.Normal;
    }
    

提交回复
热议问题