Open TamilarasanGunasekaran opened 6 months ago
Note that this is not "gray border", it is the background color peeking through space between the square's border and square's background. If you use SnapsToDevicePixels="True", this reproduces in a stable way with DPI 125%:
I agree that should certainly not happen, at least not with this property set.
As a workaround, you can use UseLayoutRounding="true" (e.g. on the Grid) (or ensure the background behind the square is of matching color if possible).
Hi, miloush's solution is great.
<Grid VerticalAlignment="Center" HorizontalAlignment="Center" SnapsToDevicePixels="True">
...
</Grid>
Have you checked the solution? If you still have issues please describe in more detail.
@huiliuss It is not as much as solution as a workaround. Also as I showed above, SnapsToDevicePixels is not enough, which is potentially a bug.
Description
When setting both the Background and BorderBrush colors to black within a border element, an unexpected behavior occurs where an inner border in gray appears only on the top and bottom sides. This inconsistency in border color rendering contradicts the expected behavior and may lead to visual discrepancies in UI design.
Reproduction Steps
Issue Screenshot:
WPFDemo.zip
Expected behavior
The gray border color should not be displayed.
Actual behavior
The gray border color is displayed.
Regression?
No response
Known Workarounds
No response
Impact
No response
Configuration
No response
Other information
No response