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

后端 未结 9 1908
心在旅途
心在旅途 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:31

    Simply hook this event handler to the Loaded event of the form, works fine.
    Do not apply this stuff in the constructor of the form (which won't work for me).

        private void aWindow_Loaded(object sender, RoutedEventArgs e)
        {
            MaxHeight = SystemParameters.FullPrimaryScreenHeight;
            MaxWidth = SystemParameters.FullPrimaryScreenWidth;
            Width = SystemParameters.FullPrimaryScreenWidth;
            Height = SystemParameters.FullPrimaryScreenHeight;
            WindowState = WindowState.Maximized;
            ResizeMode = ResizeMode.NoResize;
            Left = 0;
            Top = 0;
            Topmost = true;
            ShowInTaskbar = false;
    
            //throw new NotImplementedException();
        }
    

提交回复
热议问题