Cleartype not working
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
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
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 at src/Wpf.Ui/Controls/FluentWindow/FluentWindow.cs around line 294 and inspect how WindowBackdropType None reaches DwmExtendFrameIntoClientArea. Reproduce with a FluentWindow on Windows 11 and compare ClearType with the custom SetWindowChrome example. Done means ClearType remains enabled when the backdrop is None without losing the intended window border behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 56/100