0

I have a WPF application that I want permanently maximised.

The application starts off maximised and that's fine.

I have set the ResizeMode="NoResize" and while this does prevent the window from being resized (by dragging the edges of the window), I find I can drag the title bar down, and the window will resize to a "Restore" state - i.e. partially filling the screen. At this point the window can't be resized (as I'd expect) or maximised once again (even if I drag the title bar back to the top of the screen)

Is there a setting that will just not allow the "restore" functionality and force the Window to always be maximised?

Edit

I've discovered this is actually a window setting, and if I turn off "Arrange windows automatically by dragging them to the corners of the screen" in Settings / System / Multitasking it prevents this (I also needed to remove the ResizeMode="NoResize" funnily enough otherwise dragging the title bar just drags the entire maximised window down).

However, I can still "Restore" it by double-clicking on the title bar. I can maximise once again by doing it again, but I don't want the user to be able to restore the window at all.

Strangely enough, doing it this way ResizeMode="NoResize" lets me restore a maximised window, but not maximise a restored normal window... I'd be happy with the other way around...

komodosp
  • 3,316
  • 2
  • 30
  • 59
  • Have you read this thread https://stackoverflow.com/questions/25499393/make-my-wpf-application-full-screen-cover-taskbar-and-title-bar-of-window. – Andy Mar 05 '19 at 18:01
  • @Andy - Unfortunately none of the answers there seem to address the "double-click on title bar" issue. The accepted answer says `ShowTitleBar="false"`, but this is not a real property, and if I use the proper property to hide the title bar (apparently, `WindowStyle="None"` it doesn't prevent this, I can still double-click on the area where the title bar would be and it undoes the maximised state, and then I can drag the window around the screen. Also when I set the height to `FullPrimaryScreenHeight`, it doesn't fill the screen, there is still about an inch of space under the window! – komodosp Mar 06 '19 at 08:38
  • Accepted answers aren't always the "best". I think that property is mahapps. You could take a look at their source code if you didn't want to use mahapps. Your other option is to windowstyle none and cover the problem area with a control. There are settings in chrome you can use to finesse passing clicks or not to the underlying window. – Andy Mar 06 '19 at 08:45

0 Answers0