I am creating a WPF window with a custom chrome, so I setted ResizeMode="NoResize" and WindowStyle="None" to implement my own chrome. However, there is an issue while maximizing the borderless window: it takes the whole screen.
I found the following trick to fix part of the issue:
http://chiafong6799.wordpress.com/2009/02/05/maximizing-a-borderlessno-caption-window/
This successfully restrain the window size to prevent from covering a taskbar. However, if the user have his taskbar positionned at the left or at the top, this won’t work, as the window is at position 0,0.
Is there any way to retrieve more accurately the available area, or to query the user taskbar’s position so I can position the maximized window accordingly?
I had a quick play around and it seems that setting the
WindowsLeftandTopproperties is ignored when settingWindowState.Maximizedwith a borderless form.One workaround would be to ignore the
WindowStatefunctions and create your ownMaximize/RestorefunctionsRough example.
Xaml:
Obviously you will want to clean this code up, but it seems to work wherever the
Taskbaris located, However you may need to add some logic to get the correctLeft,Topif the users font DPI is larger than 100%