diff --git a/src/Avalonia.Controls/Platform/IWindowImpl.cs b/src/Avalonia.Controls/Platform/IWindowImpl.cs
index d864ca35c3..888748fd89 100644
--- a/src/Avalonia.Controls/Platform/IWindowImpl.cs
+++ b/src/Avalonia.Controls/Platform/IWindowImpl.cs
@@ -172,5 +172,13 @@ namespace Avalonia.Platform
/// Gets or sets a callback invoked when changes.
///
Action? AllowedWindowActionsChanged { get => null; set { } }
+
+ ///
+ /// Informs the platform about the thickness of application-drawn shadow decorations
+ /// so that the platform can distinguish the window content area from shadows.
+ /// It's platform's responsibility to synchronize this with window resize and rendering of the next frame
+ ///
+ /// The shadow thickness on each side, in DIPs.
+ void SetShadowExtents(Thickness extents) { }
}
}
diff --git a/src/Avalonia.Controls/Window.cs b/src/Avalonia.Controls/Window.cs
index 37b75b1b27..217147094f 100644
--- a/src/Avalonia.Controls/Window.cs
+++ b/src/Avalonia.Controls/Window.cs
@@ -805,6 +805,7 @@ namespace Avalonia.Controls
// Only use platform margins if drawn decorations are not active
WindowDecorationMargin = PlatformImpl?.ExtendedMargins ?? default;
TopLevelHost.DecorationInset = default;
+ PlatformImpl?.SetShadowExtents(default);
return;
}
@@ -815,6 +816,9 @@ namespace Avalonia.Controls
? decorations.FrameThickness : default;
var shadow = parts.HasFlag(Chrome.DrawnWindowDecorationParts.Shadow)
? decorations.ShadowThickness : default;
+
+ PlatformImpl?.SetShadowExtents(shadow);
+
var margin = new Thickness(
frame.Left + shadow.Left,
titleBarHeight + frame.Top + shadow.Top,