diff --git a/src/Avalonia.Controls/Window.cs b/src/Avalonia.Controls/Window.cs index c4a09ac043..3cbfdbd657 100644 --- a/src/Avalonia.Controls/Window.cs +++ b/src/Avalonia.Controls/Window.cs @@ -145,11 +145,9 @@ namespace Avalonia.Controls : base(impl) { impl.Closing = HandleClosing; + impl.WindowStateChanged = HandleWindowStateChanged; _maxPlatformClientSize = PlatformImpl?.MaxClientSize ?? default(Size); Screens = new Screens(PlatformImpl?.Screen); - - if (PlatformImpl != null) - PlatformImpl.WindowStateChanged = s => WindowState = s; } /// @@ -318,6 +316,20 @@ namespace Avalonia.Controls return args.Cancel; } + protected virtual void HandleWindowStateChanged(WindowState state) + { + WindowState = state; + + if (state == WindowState.Minimized) + { + Renderer.Stop(); + } + else + { + Renderer.Start(); + } + } + /// /// Hides the window but does not close it. ///