Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

I want to achieve the same effect as Windows Media Player or Browser based Flash players which take up the ENTIRE (not even the taskbar is visible) real estate when maximized.

This works fine if the WindowState is set to Maximized and the WindowStyle is set to None in XAML so the app is started in that state. Problem is I want to start the app in a bordered window and when the user chooses, maximize as specified above. In the StateChanged handler I check for Maximized state and if this is the case I set the WindowStyle to None. This has the effect of maximizing the window but NOT covering the taskbar. The following code will make this work as I want but its a hack and I'd like to clean it up:

if (WindowState == WindowState.Maximized)
{
    m_videoWindow.Maximize();

    WindowStyle = WindowStyle.None;

    //the following makes this work but I would like to clean it up
    Hide();
    Show();
}

EDIT This (from 2006 when still in CTP) mentions the problem and someone from MS states they hope to improve full screen support in the next version, have these improvements been made?

like image 256
Simon Fox Avatar asked Sep 23 '09 09:09

Simon Fox


1 Answers

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

like image 186
Eduardo Molteni Avatar answered Sep 22 '22 22:09

Eduardo Molteni