1

Either I'm going crazy or borders with a corner radius do not render correctly in UWP. Take this extremely simple example:

<Border CornerRadius="6" BorderBrush="Blue" BorderThickness="1">
     <Rectangle Fill="Black"   />
</Border>

And see how the rectangle extends slightly beyond border:

enter image description here

This happens in the designer in the visual studio and when the app is running.

It only seems to happen when there is a borderthickness >0 on the border.

Any idea why this happens?

Martin Richards
  • 905
  • 2
  • 9
  • 12
  • Any updates on this issue? This seems like a very weird thing for Microsoft to overlook and seems to be an issue for years now. – nreh Jan 09 '22 at 02:24

2 Answers2

0

If you are looking to apply corner radius to rectangle. Its better to use RadiusX and RadiusY properties of rectangle. Using like this will not cause any issues in rendering.

<Rectangle Width="100" RadiusX="10" RadiusY="10" Height="60" Stroke="Red" StrokeThickness="2" Fill="Black" > </Rectangle>

enter image description here

Vignesh
  • 1,824
  • 2
  • 10
  • 27
0

I managed to find a rather annoying solution by just using two borders. One with the correct border radius and style, and a second border within in for fine tuning the corners that kept clipping through.

I noticed the issues were mostly in the upper left and right corners and it was fixed by altering the corner radius of the inner border and padding of the outer border.

Source: https://stackoverflow.com/a/61468325

nreh
  • 476
  • 8
  • 13