-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Labels
bughelp-wantedA contribution from the community would be most welcome.A contribution from the community would be most welcome.os-windows
Description
Describe the bug
Incorrent behavoir on changing scaling and/or resolution on Windows, when WindowState.Maximized.
After scaling down (from 150% to 100%):
After scaling up (from 150% to 175%) it acts as WindowState.Fullscreen
And same for changing screen resolution up and down.
To Reproduce
Step to reproduce:
- Create project with latest prerealse Avalonia
- Change App.xaml.cs code
- Run and change resolution or scaling
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using Avalonia.Platform;
using Avalonia.Threading;
namespace Avalonia.Windows.Scaling.Bug;
public partial class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow()
{
WindowState = WindowState.Maximized,
ExtendClientAreaToDecorationsHint = false,
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome,
ExtendClientAreaTitleBarHeightHint = -1,
SystemDecorations = SystemDecorations.None
};
}
base.OnFrameworkInitializationCompleted();
}
}
Expected behavior
Window stays maximized
Avalonia version
12.0.999-cibuild0058128-alpha
OS
Windows
Additional context
Dirty and temporary fix:
desktop.MainWindow.ScalingChanged += (s, e) =>
{
desktop.MainWindow.WindowState = WindowState.Minimized;
Dispatcher.UIThread.InvokeAsync(() =>
{
desktop.MainWindow.WindowState = WindowState.Maximized;
desktop.MainWindow.Focus();
});
};
MinecraftYJQ
Metadata
Metadata
Assignees
Labels
bughelp-wantedA contribution from the community would be most welcome.A contribution from the community would be most welcome.os-windows