Statusbar misplaced when window maximised (and occasionally on resize)
See original GitHub issueDescribe the bug Demo project: https://github.com/fluffynuts/tsm (apologies, it’s a bit of a hacked-together thing right now, but it does demonstrate the issue on windows).
When cmd or pwsh or Windows Terminal are maximised and I start up services.exe, the status bar is stuck to the top of the root window (may also be invisible up there) instead of the bottom. Resizing the window makes it (mostly) go to the bottom again, but sometimes it disappears.
To Reproduce
- Requires a windows machine
- launch cmd.exe or windows terminal or pwsh.exe, maximise, cd to project dir
npm start
in https://github.com/fluffynuts/tsm- status bar will either be missing (obscured) or on the top of the console
- resize slowly - it will jump to the bottom, and back up again sometimes, though it mostly stays on the bottom. Maximise again, and the status bar will disappear.
- starting the app in a non-maximised console has the statusbar in the correct place (bottom)
Expected behavior StatusBar, having been pinned to the bottom of the root window, should stay there.
Screenshots maximised: resized: non-maximised start:
Desktop (please complete the following information):
- OS: Windows 11, dotnet 6.0 or 7.0 (same result)
(edited: I had to change the name of the project because services.exe
doesn’t work in the path - windows keeps trying to launch services.msc
and failing - so now it’s tsm
- Terminal Service Manager)
Issue Analytics
- State:
- Created 10 months ago
- Comments:6
Top GitHub Comments
Ok, for anyone else who stumbles across this, the main problem (I think) was that I was calling
Application.Run(new MainWindow())
. If I follow the advice of @tznind and put the status bar onApplication.Top
- but also, very importantly, add my ownMainWindow
to the existingApplication.Top
and thenApplication.Run(Application.Top)
, then the statusbar behaves very well.This services tool is now ready to show my team - I know at least one person who is going to like it, because he was just as annoyed as I was to have to wait for services.msc to complete state changes on each individual service.
@fluffynuts thanks for reporting this. A
MenuBar
inside aWindow
is working well by always standing on the top, but aStatusBar
inside aWindow
really fail by not always standing on the bottom. I’ll try to fix this, but I need to give some advice on this. Having them inside aWindow
the user is responsible to deal with the position of the other views only. So the top position of the other views must be greater or equal to one and the bottom position must be lower or equal to minus one. Otherwise the views will be under theMenuBar
on top and under theStatusBar
on bottom.