Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show hidden TaskBar if WPF application is maximized

If the auto-hide of Windows 10 TaskBar is ON then when the app is running will cover it and there is no way to get to the TaskBar with the mouse cursor. Any way to solve this?

mc:Ignorable="d" WindowState="Maximized" WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
like image 646
fpuglap Avatar asked Oct 30 '25 11:10

fpuglap


1 Answers

This is one of the biggest problems with the WindowChrome/WindowStyle="None" functionality in WPF. I don't know a 100% full proof way of handling it. The best way I've been able to find online is to use some interop to manually handle the Window's WndProc function and intercept the WM_GETMINMAXINFO message. This message controls the dimensions for a maximized window. Using this method, you can subtract a pixel or two from the maximized dimensions so that the taskbar can poke through.

Since the taskbar can be positioned in different corners of the screen, you can use some more interop to detect the current location of the taskbar. Like I said, this method doesn't work perfectly. Sometimes the taskbar gets stuck behind the window. Until someone posts a better method, it's the best I've been able to find. Here's a code sample (not mine) that I found on GitHub:

https://gist.github.com/MortenChristiansen/6463580

like image 157
CJF Avatar answered Nov 02 '25 04:11

CJF