Open ejohnson-dotnet opened 1 month ago
You could try setting SnapsToDevicePixels
to True
<Window ... SnapsToDevicePixels="True">
@ejohnson-dotnet does the above settings helps solve your problem?
Please attach a repro project. If it is a rounding issue, you can also set UseLayoutRounding=True
. Note though that there isn't any element with borders, it feels like it's the window surface that is not aligned with the native window and if that's the case I think should be fixed even if workarounds were available.
Here is a project to reproduce the issue.
Yes, setting 'SnapsToDevicePixels' or 'UseLayoutRounding' to 'True' does fix the issue.
Description
I have a simple WPF app with a grid showing textblocks and textboxes.
If the textblock is a certain length, the window shows a black vertical bar on the right. Adding one character to the textblock eliminates the black bar.
Here is the Xaml code for the window. If you add one character or remove one character from the textblock, the line on the right goes away.
I have screen shots of the window below.
This window shows a black bar on the right
This window does not show the bar. The only difference is the text length.
Reproduction Steps
Use this code in a WPF Xaml window:
Expected behavior
It should not show the black vertical bar on the right side of the window.
Actual behavior
It is showing a vertical black bar on the right side of the window.
Regression?
I have tried .NET 4.8, .NET 7 and .NET 8. All produce the same problem.
Known Workarounds
No response
Impact
No response
Configuration
.NET 8, C#, Windows 11 Pro x64
Other information
No response