AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
26.09k stars 2.26k forks source link

Minimizing and restoring a window changes its position on Windows 10 #8182

Open RationalFragile opened 2 years ago

RationalFragile commented 2 years ago

Describe the bug Minimizing and restoring (unminimizing) a normal window changes its position when it's "docked/snapped" to one side of the screen.

To Reproduce

  1. Create new blank Avalonia MVVM Project and run it.
  2. Dock the window to one side of the screen (win+right arrow)
  3. Click on its icon in the taskbar to minimize it and click again to unminimize it.
  4. The window will be back to the center of the screen.

Expected behavior The window should stay the same after and before minimizing. I tested other programs (explorer, paint, random software) and they all remain where they were before minimizing while Avalonia resets the position to the center (or whatever the position was before snapping the window to the side).

Desktop (please complete the following information):

MikeCodesDotNET commented 2 years ago

I wanted to test this on my machine (Windows 11) and it's working as expected.

It'd be interesting to see if someone else running Win10 can reproduce this.

timunie commented 2 years ago

I can confirm this issue running ControlCatalog on Windows 10.

JosefNemec commented 9 months ago

I have very similar issue on Windows 10, Avalonia 11.0.7. Minimizing a window (either using task bar or minimize button) sets position to -32000 on both axis. Restoring a window sets back previous position, but this is really annoying if you are trying to implement system that saves and restores window positions across app instances. Especially since window state is set to minimize after that -32000 position is set.

timunie commented 9 months ago

@JosefNemec can you test with this PR? https://github.com/AvaloniaUI/Avalonia/pull/14470