amwx / FluentAvalonia

Control library focused on fluent design and bringing more WinUI controls into Avalonia
MIT License
981 stars 92 forks source link

Window moves up the screen when resizing. #581

Open Omsad opened 3 months ago

Omsad commented 3 months ago

Describe the bug Hit the toggle button in Example.zip, the window will move up the screen as the text changes height.

Desktop/Platform:

Additional context This doesn't happen when I inherit directly Window, so it appears to be a problem with the AppWindow class.

Omsad commented 1 month ago

After more investigation I'm unsure about if this is a problem with FluentAvalonia or if it should be raised in Avalonia instead.

This looks to have been introduced by a change made in 11.1.0-beta1 of Avalonia, e.g. in 11.0.11 the window resizes as expected and remains in the correct location.

Looking at the changes made, it does appear that how the WM_NCCALCSIZE message is handled has been altered but I do not know enough about the various Dwm... calls to know if this is the root cause.

Interestingly if I set ExtendClientAreaToDecorationsHint = true on the AppWindow, the window will no longer move up the screen. Unfortunately this also appears to stop it from calculating it height correctly when the amount of text is changed.

Note I have also run the example on FluentAvalonia 2.1.0-preview6 and the problem remains.