Skip to content

Fix borders and shadows on Windows 10 in extended mode#21412

Merged
MrJul merged 1 commit into
AvaloniaUI:masterfrom
MrJul:fix/win10-extended-shadows
May 28, 2026
Merged

Fix borders and shadows on Windows 10 in extended mode#21412
MrJul merged 1 commit into
AvaloniaUI:masterfrom
MrJul:fix/win10-extended-shadows

Conversation

@MrJul

@MrJul MrJul commented May 21, 2026

Copy link
Copy Markdown
Member

What does the pull request do?

This PR fixes ExtendClientAreaToDecorationsHint="True" not displaying shadows and borders on Windows 10 correctly when WindowDecorations is Full or BorderOnly.

What is the current behavior?

Borders and shadows, drawn by the OS, are missing when ExtendClientAreaToDecorationsHint is true on Windows 10 and Windows Server 2019/2022.

What is the updated/expected behavior with this PR?

The borders and shadows are displayed.

How was the solution implemented (if it's not obvious)?

In #20217, I made sure that extended and non-extended modes result in the exact same window styles, as it was very hard to reason about which styles were effectively applied before.

However, on Windows versions older than build 22000 (< Windows 11), DWM still draws the full caption when WS_CAPTION is specified, even if we reserved only a single pixel border for it. Windows 11 respects that correctly. To resolve this issue, the non-client rendering policy (DWMWA_NCRENDERING_POLICY) was set to DWMNCRP_DISABLED on these older versions. Doing so caused the shadows and borders not to be rendered, which was missed.

Plus, it turns out that the non-client rendering policy gets automatically reverted when WGL is used on Windows 10, so it wasn't really a good solution.

Rather than piling workarounds, this PR now removes the WS_CAPTION style in this case. The NC rendering policy is set to DWMNCRP_ENABLED in all cases, causing the borders and shadows to be displayed on all Windows versions.

All integration tests related to ExtendClientAreaToDecorationsHint are still passing.

Fixed issues

@MrJul MrJul added bug os-windows backport-candidate-12.0.x Consider this PR for backporting to 12.0 branch labels May 21, 2026
@avaloniaui-bot

Copy link
Copy Markdown

You can test this PR using the following package version. 12.1.999-cibuild0065690-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@MrJul MrJul added the customer-priority Issue reported by a customer with a support agreement. label May 26, 2026
@MrJul MrJul force-pushed the fix/win10-extended-shadows branch from 4afe7f5 to f501581 Compare May 27, 2026 13:38
@avaloniaui-bot

Copy link
Copy Markdown

You can test this PR using the following package version. 12.1.999-cibuild0065826-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@MrJul MrJul added this pull request to the merge queue May 28, 2026
Merged via the queue into AvaloniaUI:master with commit 1f8a9e7 May 28, 2026
10 checks passed
@MrJul MrJul deleted the fix/win10-extended-shadows branch May 28, 2026 10:03
MrJul added a commit to MrJul/Avalonia that referenced this pull request May 28, 2026
@MrJul MrJul added backported-12.0.x and removed backport-candidate-12.0.x Consider this PR for backporting to 12.0 branch labels May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported-12.0.x bug customer-priority Issue reported by a customer with a support agreement. os-windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows 10 shows no border with Full/BorderOnly window decoration and ExtendClientAreaToDecorationHint=True

3 participants