WPF Window with Style=None cover taskbar when Maximised after app initialization WPF Window with Style=None cover taskbar when Maximised after app initialization wpf wpf

WPF Window with Style=None cover taskbar when Maximised after app initialization


This article explains it all: Maximizing window (with WindowStyle=None) considering Taskbar.

Also worth checking out: Custom Window Chrome in WPF.

Edit: Now new, is the WPF Shell Integration Library that allows complete restyle of the window chrome without the headaches of reimplementing move, resizing, etc.

Edit 2015: Shell Integration Library is now integrated in WPF and MS retired the code


I found I could maximize to full screen (covering the taskbar) by setting the properties when creating the window (in xaml), but was not able to switch back and forth after creation. After some experimenting, I found the order the properties are set seems to matter:

public bool IsFullscreen{    get     {        return WindowState == System.Windows.WindowState.Maximized            && ResizeMode == System.Windows.ResizeMode.NoResize            && WindowStyle== System.Windows.WindowStyle.None;    }    set    {        if ( value )        {            ResizeMode = System.Windows.ResizeMode.NoResize;            WindowStyle = System.Windows.WindowStyle.None;            WindowState = System.Windows.WindowState.Maximized;        }        else        {            ResizeMode = System.Windows.ResizeMode.CanResize;            WindowStyle = System.Windows.WindowStyle.SingleBorderWindow;            WindowState = System.Windows.WindowState.Normal;                    }    }}

Note that WindowState comes last in the setter.


To get this to properly work in my WPF/.NET 4.0 application I am calling this function whenever I enter or exit full screen mode:

private static void RefreshWindowVisibility(Window window)        {            if (window.OriginalWindowState == WindowState.Maximized)            {                window.Hide();                window.Show();                window.BringIntoView();            }        }

There is a flicker associated with this method, but it seems the same flicker exists when going to full screen mode on Chrome. Internet Explorer seems to take a different approach.