Make my wpf application Full Screen (Cover taskbar and title bar of window)

后端 未结 9 1914
心在旅途
心在旅途 2020-12-05 14:34

I would like to make my application such that it can maximize to full screen means it hide the windows task bar and the title bar as well. And it should triggered by a butto

9条回答
  •  不知归路
    2020-12-05 15:18

    If the taskbar doesn't disappear, it may help to change the Window visibility before and after changing window style, like this:

        private void MainWindow_StateChanged(object sender, EventArgs e) {
            if (this.WindowState == WindowState.Maximized) {
                // hide the window before changing window style
                this.Visibility = Visibility.Collapsed;
                this.Topmost = true;
                this.WindowStyle = WindowStyle.None;
                this.ResizeMode = ResizeMode.NoResize;
                // re-show the window after changing style
                this.Visibility = Visibility.Visible;
            }
            else {
                this.Topmost = false;
                this.WindowStyle = WindowStyle.SingleBorderWindow;
                this.ResizeMode = ResizeMode.CanResize;
            }
        }
    

提交回复
热议问题