dotMorten / WinUIEx

WinUI Extensions
https://dotmorten.github.io/WinUIEx
MIT License
582 stars 37 forks source link

Improve window resizing when using WindowEx Persistence #64

Closed mikebattista closed 2 years ago

mikebattista commented 2 years ago

Is there any way we could resize the window before it's shown to the user? Right now on app launch, I see the window flash at its default size, then the window is resized with a solid background, then the window content loads, which is a bit clunky and jarring. Not sure currently if this is a library issue or if there's something we can do in the app to improve the experience.

dotMorten commented 2 years ago

I’ve tried but failed. Perhaps @marb2000 can suggest the right time to do this?

mikebattista commented 2 years ago

@rkarman do you have any guidance here? The window size and position are getting loaded with the below. We're wondering if there's a better way to do this so all the window resizing is handled before we show anything to the user.

https://github.com/dotMorten/WinUIEx/blob/ac3fe32e30161e95c2d07bbcf94ada7e6ce6f169/src/WinUIEx/WindowManager.cs#L78-L88 https://github.com/dotMorten/WinUIEx/blob/9e4beb4a4e664b68d52f0697f426b93dd211b677/src/WinUIEx/WindowManager.cs#L241-L293

dotMorten commented 2 years ago

I just figured it out! If I restore position when I receive the WM_SHOWWINDOW message, there's no visible jump.

mikebattista commented 2 years ago

Awesome!