Avalonia
Avalonia copied to clipboard
Border BoxShadow only works with BackgroundSizing=CenterBorder
Describe the bug
Setting BackgroundSizing to anything other than CenterBorder causes the BoxShadow to not render:
To Reproduce
<StackPanel Orientation="Horizontal"
Spacing="20"
HorizontalAlignment="Center">
<Border Background="Gray"
Width="200" Height="200"
BoxShadow="0 16 16 0 #35000000">
<TextBlock Text="CenterBorder"
HorizontalAlignment="Center"/>
</Border>
<Border Background="Gray"
Width="200" Height="200"
BoxShadow="0 16 16 0 #35000000"
BackgroundSizing="InnerBorderEdge">
<TextBlock Text="InnerBorderEdge"
HorizontalAlignment="Center"/>
</Border>
<Border Background="Gray"
Width="200" Height="200"
BoxShadow="0 16 16 0 #35000000"
BackgroundSizing="OuterBorderEdge">
<TextBlock Text="OuterBorderEdge"
HorizontalAlignment="Center"/>
</Border>
</StackPanel>
Expected behavior
No response
Avalonia version
11.1-beta1
OS
Windows
Additional context
No response
Related: #13251 Now that we have BackgroundSizing which draws via geometry (if not wanting the Skia default), it might be time to allow shadows on things that aren't just Rectangles
Hmm, I suspect there is a bit more going on here. I don't recall running across the box shadow code for the BackgroundSizing work. That said, I suspect the box shadow only ever worked with the simple rendering path.
I suspect the box shadow only ever worked with the simple rendering path.
I am pretty sure that's the case.
Effects="drop-shadow(5 5 0 Green)"
should still work with complex geometry. And we might be able to convert box shadow to drop shadow for complex borders.
Oh, I didn't know about the Effects API which is what along the lines of what I was thinking was needed. That works nicely.