Cleartype not working
Describe the bug
Using FluentWindow stops cleartype from working
Here is an example image, on the left is non-cleartype using greyscale and cleartype is on the right of the image
Even setting the WindowBackdropType to None does not fix this, however you can do the following to fix it:
public class ClearTypeFluentWindow : FluentWindow
{
protected override void SetWindowChrome()
{
try
{
WindowChrome.SetWindowChrome(
this,
new WindowChrome
{
CaptionHeight = 0,
CornerRadius = default,
GlassFrameThickness = new Thickness(0),
ResizeBorderThickness = this.ResizeMode == ResizeMode.NoResize ? default : new Thickness(4),
UseAeroCaptionButtons = false,
});
}
catch (COMException)
{
// Ignored, matching WPF-UI's own SetWindowChrome.
}
}
}If you look at https://github.com/lepoco/wpfui/blob/ffebacd61058170cf63864b7d5aa730cffff848a/src/Wpf.Ui/Controls/FluentWindow/FluentWindow.cs#L294 you can see the comment "// 0.00001 so there's no glass frame drawn around the window, but the border is still drawn." Anything other than 0 will still call DwmExtendFrameIntoClientArea, which breaks ClearType. At least on my version of windows the comment is out of date and actually has no effect anyway. I would imagine that it may be there to fix windows 10, maybe a call to Utilities.IsOSWindows11OrNewer could be used?
To Reproduce
Use a FluentWindow
Expected behavior
Cleartype should work if Window set to None. It is understandable that Mica cannot render cleartype as explained in https://github.com/lepoco/wpfui/issues/177#issuecomment-1125828059
Screenshots
No response
OS version
Windows 11 25H2 26200.8875 I am using tfm net10.0-windows10.0.19041.0
.NET version
Net 10
WPF-UI NuGet version
4.3.0
Additional context
No response
Source: lepoco/wpfui