dotnet / dotnet/wpf

[Bug] Set WindowChrome.NonClientFrameEdges will cause UI layout problem

Open
#11,204 20 comments 1 reaction 0 assignees View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

When I set `WindowChrome.NonClientFrameEdges="Left,Right,Bottom"`, the UI elements layout will be misaligned after switch Windows theme or color mode.

### Reproduction Steps

Create a blank WPF project, set the WindowChrome like that:

```xaml



```

Put any visiable element on the window, like:

```xaml

```

Run the project.

Image

Switch Windows theme or color mode. The UI elements layout will be misaligned.

Image

### Expected behavior

There should be no issues with UI elements.

### Actual behavior

UI elements are misaligned.

In another project of mine, frequently switching color modes caused UI elements to become constantly misaligned. In other words, as long as I kept switching, the elements would shift until they disappeared.

### Regression?

_No response_

### Known Workarounds

Set the `WindowChrome.NonClientFrameEdges="None"` can avoids this problem, but I need to use it. This isn't really a solution for me.

### Impact

_No response_

### Configuration

- .NET 8.0 and .NET 9.0.
- Windows 11 25H2 build 26200.6899.
- x64

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.