0

pic

as shown in the picture, WindowState = WindowState.Maximized; doesn't fully and correctly maximize the window; it doesn't fill the screen and it shouldn't go over the taskbar either. I used

WindowStyle="None"
AllowsTransparency="True"
SizeChanged="Window_SizeChanged"
Title="MainWindow" Height="1000" Width="1500" KeyDown="www_KeyDown"
WindowStartupLocation="CenterScreen"
ResizeMode="NoResiz"

which I thought should work.

I didn't change the MaxHeight or Width either, so I am not sure what is happening here.

Connor Low
  • 5,900
  • 3
  • 31
  • 52
  • The invisible borders are still there. Remove this: `WindowStyle="None"` (to test the difference) – Jimi Sep 04 '21 at 21:39
  • @Jimi that doesn't make any sense tho cuz I want a custom window style and it still would look weird – skillgamer Sep 04 '21 at 23:16
  • If you want to *maximize* a borderless Window, you need to calculate its position and size and take into account the invisible borders around it (7 + 1 pixels). It's not hard. Get the current Screen (where you Window is shown or moved to) and use its `WorkingArea` as reference. -- See [the notes here](https://stackoverflow.com/a/53026765/7444103) about the Screen coordinates and VirtualScreen layout. – Jimi Sep 04 '21 at 23:21
  • This issue is quite frequently, you can look at this to see example of recalculation of the window size https://github.com/6demon89/Tutorial.WPF/blob/master/Tutorial.WPF/MainWindow.xaml.cs – Demon Sep 13 '21 at 03:58

0 Answers0