Open Apskalle opened 3 months ago
Additional:
<ui:FluentWindow x:Class="WpfNet9App.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:local="clr-namespace:WpfNet9App"
mc:Ignorable="d"
ExtendsContentIntoTitleBar="True"
SizeToContent="WidthAndHeight"
Title="MainWindow">
<Grid>
<Border Width="300" Height="300" Background="Yellow"/>
</Grid>
</ui:FluentWindow>
In VS preview window:
When run:
The Wpf source shows MS have been looking at this, as far as I can tell w/o really fixing it
From comment in https://github.com/dotnet/wpf/tree/main/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Window.cs, line 2557
// We don't do anything that uses the Window styles below so we might as // well close the using so that we update the new style to the hwnd. // This change was made to solve a problem where SizeToContent.WidthAndHeight borderless // windows where actually bigger than the content size. This was b/c of // the fact that we didn't update the style of the hwnd before setting // the RootVisual which inturn calls MeasureOverride on Window from // where we calculating the non-client area size using the stale // style bits from the hwnd.
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
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