-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect borders drawn for non-uniform border thickness #17752
Comments
I imagine this is by design as I get similar results with WPF with the gaps. Instead, I suggest you cover up the deficits with <Window.Styles>
<Style Selector="Rectangle">
<Setter Property="Width" Value="8" />
<Setter Property="Height" Value="8" />
<Setter Property="Fill" Value="AntiqueWhite" />
</Style>
<Style Selector="StackPanel > Border">
<Setter Property="BorderBrush" Value="Blue" />
</Style>
</Window.Styles>
<Viewbox RenderOptions.EdgeMode="Aliased">
<StackPanel
HorizontalAlignment="Left"
VerticalAlignment="Top"
Orientation="Horizontal">
<Border Padding="1,1,1,0" BorderThickness="0,0,0,1">
<Rectangle />
</Border>
<Border Padding="1,1,0,1" BorderThickness="0,0,1,0">
<Rectangle />
</Border>
<Border Padding="1,1,0,0" BorderThickness="0,0,1,1">
<Rectangle />
</Border>
<Border Padding="1,0,1,1" BorderThickness="0,1,0,0">
<Rectangle />
</Border>
<Border Padding="1,0,1,0" BorderThickness="0,1,0,1">
<Rectangle />
</Border>
<Border Padding="1,0,0,1" BorderThickness="0,1,1,0">
<Rectangle />
</Border>
<Border Padding="1,0,0,0" BorderThickness="0,1,1,1">
<Rectangle />
</Border>
<Border Padding="0,1,1,1" BorderThickness="1,0,0,0">
<Rectangle />
</Border>
<Border Padding="0,1,1,0" BorderThickness="1,0,0,1">
<Rectangle />
</Border>
<Border Padding="0,1,0,1" BorderThickness="1,0,1,0">
<Rectangle />
</Border>
<Border Padding="0,1,0,0" BorderThickness="1,0,1,1">
<Rectangle />
</Border>
<Border Padding="0,0,1,1" BorderThickness="1,1,0,0">
<Rectangle />
</Border>
<Border Padding="0,0,1,0" BorderThickness="1,1,0,1">
<Rectangle />
</Border>
<Border Padding="0,0,0,1" BorderThickness="1,1,1,0">
<Rectangle />
</Border>
<Border Padding="0,0,0,0" BorderThickness="1,1,1,1">
<Rectangle />
</Border>
</StackPanel>
</Viewbox> Please leave the issue open for a maintainer to decide. |
Thanks, that indeed helps immensely. It feels wrong to have the gaps between the edge of the rectangle and the strokes, but at with padding I do indeed have a workaround which makes relative sense. |
Are you using LayoutRounding probably or SnapToDevicePixels? |
Describe the bug
When applying a non-uniform border thickness the layout of the content vs the layout of the strokes is off by 1 or 2 pixels
This is applying a 1 thickness border to a 8x8 rectangle. You will see that the vertical layout of the rectangle moves up and down more than the thickness of the stroke, and that the stroke has gaps between it and the rectangle.
Sometimes the stroke aligns with the rectangle, sometimes not
When the layout is horizontal then the mistakes on the strokes happen on the vertical borders
When the layout is vertical then the mistakes happen on the horizontal borders.
To Reproduce
Expected behavior
The border to be aligned with the content
The border to not have gaps between it and the content
NOTES
I discovered by trial and error that this bug only occurs when being the controls are in a stackpanel together.
If I wrap each border in its own stack panel like this:
Then it correctly renders all of the strokes with no errors.
Avalonia version
11.2.1
OS
Windows
Additional context
Related Issue
Consolonia jinek/Consolonia#200 is blocked on the resolution of this bug.
The text was updated successfully, but these errors were encountered: