SizeToContent and ExtendsContentIntoTitleBar
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 9.6k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Not really a (wpfui-) bug but setting ExtendsContentIntoTitleBar to true and setting SizeToContent to WidthAndHeight gives the strange effect of the content being misaligned in the window, leaving a black area right and bottom, as described here
Since this rates to be common using FluentWindow, maybe a fix can be included there.
Meanwhile, a fix that seems to work but gives som flicker:
In the windows ContentRendered call
private void corewnd_ContentRendered(object sender, System.EventArgs e)
{
var firstrender = true;
if (firstrender)
{
InvalidateVisual();
firstrender = false;
}
}
To Reproduce
Set FluentWindow ExtendsContentIntoTitleBar=true and WidthAndHeight=SizeToContent and add content.
Expected behavior
Normal content display
Screenshots
No response
OS version
Win 11 Pro
.NET version
8
WPF-UI NuGet version
4.0.3
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the FluentWindow implementation and reproduce the issue on Windows 11 with .NET 8 using ExtendsContentIntoTitleBar=true, SizeToContent=WidthAndHeight, and sample content. Investigate the misalignment and black right/bottom areas, using the ContentRendered workaround only as context. Done means content displays normally without the black area or flicker.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100